1.18.0 performance items: tests, the reference budget gate tightened (JS 195 kB, 404 without its exception, TTL check), docs (performance.md, AGENT.md, iapl-performance, module pages, api.md), changelog: what changes for an existing site

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-12-01 15:54:15 +01:00
co-authored by Claude Opus 5.5
parent d628839235
commit f0127ac1b8
35 changed files with 1154 additions and 288 deletions
+44
View File
@@ -33,6 +33,50 @@ once there are more than 20.
> `confirmByEmail: { linkMinutes, sameBrowser, adminConfirm, logLinkWhenMailFails, notices, maxMailsPerHour }`
> (security.md "Set-up confirmed by e-mail").
### Speed and growth (docs/performance.md)
> **What changes for an existing site** (no edit needed unless a line says so; each with its opt-out):
>
> 1. **Metadata is removed from JPEG and PNG uploads** (camera, date, GPS position, comments) — without
> re-encoding: the pixels stay byte for byte, the colour profile stays. A photo whose EXIF says "rotate" is turned
> once (JPEG quality 92) so it does not show sideways. Only new uploads; stored files are not touched.
> Off: `buildOptimizeUploadHook({ stripMetadata: false })`.
> 2. **MongoDB: TTL indexes delete old consent records and statistics by themselves** — the records the daily purge
> already deleted (older than `retentionDays`: 1095 days for the consent log, 90 for statistics), now also on a
> quiet site where no new record starts the purge. At the first start the plugin adds a hidden date
> (`iaplTtlFrom`) to every existing record and creates the index `iapl_ttl`; **records older than the retention
> are deleted by MongoDB within a minute of that start** (they were due already). Off: `consentLog: { ttlIndex:
> false }`, `stats: { ttlIndex: false }` (the index is dropped at the next start; the purge stays). Postgres /
> SQLite: nothing changes (no field, no migration).
> 3. **A versioned plugin collection or global keeps 20 versions per document** (Site settings, Site integrations,
> the forms…) when a project turned its versions on without a limit — Payload's default is 100. **The oldest
> versions above 20 are removed when such a document is saved next.** Keep more: set `max` / `maxPerDoc` in your
> override. The plugin itself turns versions on nowhere.
> 4. **Forms load their code only on pages that show a form.** `BuilderForm` and `Turnstile` from
> `@intecion/ipal-kit/client` are now lazy wrappers with the same props; the server renders the whole form as
> before. On other pages 6–9 KB less JavaScript (gzip; reference site: webpack −8.8 KB, Turbopack −6.1 KB). The eager components: `@intecion/ipal-kit/client/eager`
> (`<RenderForm Form={BuilderForm}>`).
> 5. **The Turnstile widget's height is kept free before Cloudflare draws it** (73 px): the form no longer jumps when
> it appears. For an invisible widget: `turnstileReserveHeight={0}` on `RenderForm` / `BuilderForm`
> (`reserveHeight={0}` on `Turnstile`).
> 6. **A background video stops for visitors who asked for less motion** (`prefers-reduced-motion`), after
> hydration; everyone else sees no change. Off: `<Media pauseForReducedMotion={false}>`.
> 7. **Card hover** (`Card interactive`, the library's link cards) fades a shadow layer instead of animating the
> card's shadow: the same lift, drawn by the compositor. The 1.17 class: `CARD_INTERACTIVE_SHADOW_CLASS`.
> 8. **Fewer database queries per page render** (36–44 %), the lightbox viewer loads on first open, the `/client`
> barrels are no longer one client boundary, the table of contents measures once per frame, Turnstile stops
> polling once drawn, the cookie banner honours reduced motion. Nothing to do.
>
> **New, off until a project turns it on:** `iapl({ unusedMedia: true })` — above the Media list, how many files no
> page, entry or setting uses, with a link to Payload's list filtered to them (deleting stays manual; **run
> `pnpm generate:importmap`** after turning it on); `forms: { submissionRetentionDays }`; `Media eager` (a logo
> above the fold, no high priority); `createNotFoundPage({ load, placeholder })` (the reference site keeps its 404
> height: CLS 0).
> **Doctor:** the `performance` and `growth` groups (warnings; `growth-versions-config` is a hint), thresholds in
> `iapl-doctor.json` → `growth`. **Agents:** the `iapl-performance` skill (`pnpm exec iapl-skills`) and the budget
> gate template. **Recommended for projects:** `index: true` on `slugHistory.slug`; the heading font with
> `preload: false` (the starter's default now); a placeholder of the 404 content's height.
## 1.17.2 — version history with readPublished, sign-in and panel actions, staff-only REST submissions and jobs, the cookie button
> **Read before upgrading.** No schema change, no migration on any database, no import-map change. What changes for
+7 -6
View File
@@ -1048,17 +1048,18 @@ Example `styles.css`: [section-code.md](./skills/iapl-block/resources/section-co
| above the fold, not the LCP (header logo) | `<Media eager>` — loads at once, no high priority, no preload | `priority` on the logo (it competes with the hero) |
| every other image | `<Media sizes={MEDIA_SIZES.third}>` — `sizes` = the width on screen; lazy by default | no `sizes` (downloads the full width), `<img>` |
| placeholder | `buildMediaPlaceholderHook` + a field in Media (blur + color) | empty boxes that "jump in" while loading |
| uploads | `buildOptimizeUploadHook` (stops images over 1.5 MB / 2560 px, converts on request); `iapl-doctor --deep` counts stored images over the limits | 8 MB phone photos in the library |
| background video | `videoMode="background"`, MP4 H.264 ≤ 20 MB, no sound, with a poster | a video as the hero without a poster, `autoplay` with sound |
| uploads | `buildOptimizeUploadHook` (stops images over 1.5 MB / 2560 px, converts on request, removes JPEG/PNG metadata — GPS, camera — without re-encoding; `stripMetadata: false` keeps it); `iapl-doctor --deep` counts stored images over the limits | 8 MB phone photos in the library |
| background video | `videoMode="background"`, MP4 H.264 ≤ 20 MB, no sound, with a poster; paused for "reduce motion" by itself (`pauseForReducedMotion={false}` turns that off) | a video as the hero without a poster, `autoplay` with sound |
| video with content | `videoMode="player"` (loads after a click) | `preload="auto"` |
| YouTube, maps, widgets | `<YouTubeEmbed>` from `/client` (the iframe only after a click); a map behind a click (a picture + a button) | a bare `<iframe>` that loads with the page |
| next.config | `images: buildImagesConfig()` (AVIF/WebP, R2, 31-day cache) | no `remotePatterns` → images from R2 without optimization |
| fonts | `next/font`, max 2 families, variable, `subsets: ['latin', 'latin-ext']` (PL), `display: 'swap'` | a `<link>` to Google Fonts, `display: 'block'`, 6 weights "just in case" |
| fonts | `next/font`, max 2 families, variable, `subsets: ['latin', 'latin-ext']` (PL), `display: 'swap'`; the heading font `preload: false` (the starter's default: the stylesheet and the hero load first) | a `<link>` to Google Fonts, `display: 'block'`, 6 weights "just in case" |
| third-party scripts | `Analytics` (via `SiteProviders`, `analytics={{ defer: true }}`) / `ConsentScript` from the plugin; `next/script` for anything else | `<script src>` without `async` in the layout, chat/map widgets loaded at start |
| animations | `transform` / `opacity` only, the token durations (`duration-fast`, reduced motion built in) or `motion-reduce:`; IntersectionObserver for "is it on screen" | animating `height` / `top` / `margin`, `transition-all`, a `scroll` listener doing work per event |
| client components | small, interaction only (§6.9); import from `@intecion/ipal-kit/client` freely — a page ships only what it renders (1.18.0) | a whole section `'use client'` |
| animations | `transform` / `opacity` only (the library's card hover fades a shadow layer), the token durations (`duration-fast`, reduced motion built in) or `motion-reduce:`; IntersectionObserver for "is it on screen" | animating `height` / `top` / `margin`, `transition-all`, a `scroll` listener doing work per event |
| client components | small, interaction only (§6.9); import from `@intecion/ipal-kit/client` freely — a page ships only what it renders; `BuilderForm` and `Turnstile` there load their code only where a form is shown (`/client/eager` for the eager ones, `RenderForm Form={…}`); the Turnstile widget's 73 px are kept free (`turnstileReserveHeight={0}` for an invisible widget) | a whole section `'use client'`; an empty box that a widget fills later |
| 404 | `createNotFoundPage({ load, placeholder })` with a block as tall as the 404 content (reference `not-found.tsx`) | a lazy 404 that moves the footer |
| data | the cached helpers of `lib/content` (`getSettings`, `resolveRoute`, `getSiteShell`…), `depth` as low as the page needs, `select` when you need one field, `cache()` around your own getters | `findGlobal` in a component without `cache()`, `depth: 2` "to be safe", a query per list item |
| what grows | logs with a retention (consent log 1095 days, statistics 90; `forms: { submissionRetentionDays }` on the client's decision), `versions: { maxPerDoc: 20 }` where you turn versions on, unused media reviewed; `iapl-doctor --deep --only growth` ([performance.md](../performance.md) §6) | `maxPerDoc: 0`, submissions kept forever without a decision, a persistent volume on `.next` |
| what grows | logs with a retention (consent log 1095 days, statistics 90 — on MongoDB a TTL index deletes them by itself, `ttlIndex: false` turns it off; `forms: { submissionRetentionDays }` on the client's decision), `versions: { maxPerDoc: 20 }` where you turn versions on (the plugin's own entities get 20 by themselves), unused media reviewed in the panel (`iapl({ unusedMedia: true })`, then `pnpm generate:importmap`); `iapl-doctor --deep --only growth` ([performance.md](../performance.md) §6) | `maxPerDoc: 0`, submissions kept forever without a decision, a persistent volume on `.next` |
| budgets | `e2e/performance.spec.ts` from the `iapl-performance` skill (`perfBudgets()` from `/doctor`): fails when a page gets slower | "it felt fast on my machine" |
Target on the built site (mobile, Lighthouse/PageSpeed): LCP < 2.5 s, CLS < 0.1, INP < 200 ms — the plugin's default
+6 -3
View File
@@ -18,12 +18,13 @@ Fix every warning — each names the file, the fix and the doc. The rules that m
| Area | Do | Never |
|---|---|---|
| LCP image | `<Media priority>` on the first image of the page — **one** per page; a header logo gets `eager` | `priority` on many images; a lazy hero; the hero as a CSS background |
| layout shift | content that arrives late keeps its space: the lazy 404's `placeholder` (its content's height), the Turnstile widget's 73 px (kept by the plugin) | an empty box a widget or a server action fills later |
| other images | `<Media sizes={MEDIA_SIZES.third}>` — the width on screen; lazy by default | no `sizes`; a plain `<img>` |
| fonts | `next/font` (self-hosted), ≤ 2 families, variable, `display: 'swap'` | a `<link>` to Google Fonts; `display: 'block'` |
| fonts | `next/font` (self-hosted), ≤ 2 families, variable, `display: 'swap'`, the heading font `preload: false` | a `<link>` to Google Fonts; `display: 'block'` |
| scripts | the plugin's `Analytics` / `ConsentScript`; `next/script` for anything else | a `<script src>` without `async` in the layout |
| embeds | `<YouTubeEmbed>`; a map or widget behind a click (a picture + a button) | an `<iframe>` that loads with the page |
| animations | `transform` / `opacity` only; the token durations (`duration-fast`) or `motion-reduce:` | animating `height`, `top`, `margin`; `transition-all`; a `scroll` listener (use IntersectionObserver) |
| client code | small `'use client'` leaves; server components by default | a whole section `'use client'` |
| client code | small `'use client'` leaves; server components by default; forms through `RenderForm` / `BuilderForm` from `/client` (their code loads only where a form is shown) | a whole section `'use client'`; importing `/client/eager` without a reason |
| server | the plugin's cached helpers (`lib/content`), `depth` as low as the page needs, `select` for one field | `findGlobal` without `cache()`; `depth: 2` "to be safe"; a query per list item |
## 2. Measure the built site
@@ -55,7 +56,9 @@ pnpm exec iapl-doctor --deep --only growth # counts and sizes per collection,
- Logs purge themselves (consent log 1095 days, statistics 90). Form submissions are kept unless
`iapl({ forms: { submissionRetentionDays } })` — ask the client (personal data) and record it in AGENTS.md.
- Versions: where you turn them on, `versions: { maxPerDoc: 20 }` (globals `max`); never `0`.
- Unused media (`growth-media`): list them for the client; the plugin never deletes media or submissions by itself.
- Unused media: `iapl({ unusedMedia: true })` (then `pnpm generate:importmap`) shows them above the Media list with a
link to Payload's filtered list; the editor deletes them there. The plugin never deletes media or submissions by itself.
- MongoDB: the consent log and statistics are deleted by TTL indexes at their retention (`ttlIndex: false` turns that off).
- Coolify: no persistent volume on `.next` (the image cache starts empty on each deploy); database backups on the
MongoDB resource.
- Thresholds of the findings: `iapl-doctor.json` → `growth`.
+2 -1
View File
@@ -105,7 +105,8 @@ description: Complete map of everything @intecion/ipal-kit provides — every ia
| `forms.turnstileOnConfigError` | `{ text: 'allow', files: 'reject' }` | what a form does while Turnstile CANNOT check (wrong / missing secret, Cloudflare down): a text form is accepted, a submission to the file endpoint is refused. Not involved while Turnstile is off | `'allow'` / `'reject'` for every form, or `{ text, files }`; `turnstileOnConfigError` at a call site (`createSubmitAction`, `attachments.submit`) wins |
| `forms.attachments` | off | **File** field in the form builder; a file is checked (size, count, type by content, refused extensions), attached to the company e-mail and dropped — **never stored**; adds `POST /api/ipal/forms/submit`, the fields `submissionFiles` / `filesDelivery` / `filesDeliveryNote` / `attemptKey` on `form-submissions`, and the **Files** texts in Form messages | `true` / `FormAttachmentsOption`: `maxSizeMB` (10), `maxTotalMB`, `maxFiles` (3), `fileTypes`, `allowRisky`, `scan` (antivirus hook — none built in), `strictPdf`, `notice`, `maxConcurrent` (2), `path`, `submit` (`maxPerMinute`, `clientIp`, `honeypotField`, `turnstileHostnames`, `turnstileOnConfigError`, `allowedOrigins`, `idleTimeoutMs`, `timeoutMs`); block only: `forms.fields.file: false` or `buildFileBlock(…)`. Postgres: `migrate:create`. Check: submit a PDF → attached to the company e-mail, absent from the customer e-mail, submission shows *File delivery: Handed to the mail server* (forms.md "Files") |
| `forms.consentFieldName` | `'consent'` | name of the GDPR consent field `submitForm` requires (read from `config.custom.ipal`) | `createSubmitAction({ consentFieldName })` / `submitForm` argument wins |
| `consentLog` | **on** (since 1.17.0) | `consent-records` collection + `POST /api/ipal/consent` (rate limit 20/min); Postgres / SQLite: a table, migration in the same deploy | `false` / `{ retentionDays }` (default 1095) |
| `consentLog` | **on** (since 1.17.0) | `consent-records` collection + `POST /api/ipal/consent` (rate limit 20/min); Postgres / SQLite: a table, migration in the same deploy; MongoDB: a TTL index deletes records older than the retention (1.18.0) | `false` / `{ retentionDays }` (default 1095) / `{ ttlIndex: false }` |
| `unusedMedia` | off | 1.18.0: a notice above upload lists with a link to the files nothing uses (manual delete); then `pnpm generate:importmap` | `true` / `{ collections: ['media'] }` |
| `consentLog.collectionOverrides` | none | changes `consent-records`: an object merges `access` / `admin` / `hooks` key by key (your keys win), a function `(collection) => collection` takes over (keep the slug) | e.g. `{ access: { read: ({ req }) => req.user?.email === '[email protected]' } }` — narrows who reads records in a project without roles |
| `jobsRunAccess` | on (since 1.17.2), only when the project writes no `jobs.access.run` | Payload's job queue over HTTP (`/api/payload-jobs/run`, `/handle-schedules`): an admin with the second factor (an admin API key counts) or `Authorization: Bearer <CRON_SECRET>` (16+ chars); before: any signed-in account of any auth collection. In-process runs (`jobs.autoRun`, `payload jobs:run`) unaffected | `false` = Payload's default; `{ secretVar }` = another variable; your own `jobs.access.run` wins. Check: `curl -H "Authorization: Bearer $CRON_SECRET" $URL/api/payload-jobs/run` → 200, without it 401 (security.md "Payload's job queue") |
| `doctor` | on (404 until `IAPL_DOCTOR_TOKEN` is set) | `GET /api/ipal/doctor` — read-only counts for `iapl-doctor --url` (users without TOTP, cookies waiting for approval, versions); Bearer token ≥ 32 characters, rate-limited, never names or values | `false` = no endpoint; `{ tokenVar, access }` (doctor.md) |
@@ -1,7 +1,7 @@
# IAPL — export index
Every public export of `@intecion/ipal-kit` (all entries: root, `/client`, `/rsc`,
`/server`, `/seed`, `/starter`, `/next/middleware`, `/admin`, `/env`, `/blocks`, `/blocks/rsc`, `/templates`, `/tokens`, `/doctor`), grouped by module. Search with grep
`/client/eager`, `/server`, `/seed`, `/starter`, `/next/middleware`, `/admin`, `/env`, `/blocks`, `/blocks/rsc`, `/templates`, `/tokens`, `/doctor`), grouped by module. Search with grep
(`grep -n "name" .agents/skills/iapl-reference/resources/api.md`) before you write anything yourself.
"Import from" column — the first entry is preferred. Plugin options, env, routes and what the
project wires: `../SKILL.md`. Module details: `node_modules/@intecion/ipal-kit/docs/<page>.md`.
@@ -13,7 +13,7 @@ project wires: `../SKILL.md`. Module details: `node_modules/@intecion/ipal-kit/d
| `ipalKit`, `IpalOptions`, `ipalEnvRules`, `IpalEnvFeatures`, `ipalT`, `ipalVar`, `IPAL_TOKENS`, `IPAL_BREAKPOINTS`, `IpalTokenName`, `IpalGlobalSlug` | as their new names | The names before 1.17.0 of `iapl`, `IaplOptions`, `iaplEnvRules`, `IaplEnvFeatures`, `iaplT`, `iaplVar`, `IAPL_TOKENS`, `IAPL_BREAKPOINTS`, `IaplTokenName`, `IaplGlobalSlug`: the same values, deprecated, removed in 2.0. Existing code keeps them; new code uses the new names (AGENT.md "Names: IAPL and ipal-kit"). |
| `iapl(options)` | `@intecion/ipal-kit` | Payload 3 plugin (`plugins: [iapl({...})]`) — the only wiring point: adds globals (SiteSettings, SiteIntegrations, CookieSettings, Notifications), roles, enforced 2FA, SEO, forms, i18n (localization), white-label, stats, consent log, `/api/ipal/*` endpoints; no auth collection → injects a simple `users`. Validates `i18n` right away (fail fast). `enabled: false` = schema stays, behaviour off. |
**Types:** `IaplOptions` — `iapl()` options: `i18n`, `access`, `twoFactor` (`{ issuer, plugin: payloadTotp }` or `false`), `whiteLabel`, `adminRoute`, `consentLog`, `content`, `cookieScanner`, `forms`, `pages`, `seo`, `searchSettings`, `stats`, `indexNow`, `siteSettingsFields`, `integrationsFields`, `globalOverrides`, `revalidatePath`, `enabled`. `GlobalOverride`, `GlobalOverrides`, `IaplGlobalSlug` — see Payload globals below.
**Types:** `IaplOptions` — `iapl()` options: `i18n`, `access`, `twoFactor` (`{ issuer, plugin: payloadTotp }` or `false`), `whiteLabel`, `adminRoute`, `consentLog`, `content`, `cookieScanner`, `forms`, `pages`, `seo`, `searchSettings`, `stats`, `indexNow`, `siteSettingsFields`, `integrationsFields`, `globalOverrides`, `revalidatePath`, `unusedMedia`, `enabled`. `GlobalOverride`, `GlobalOverrides`, `IaplGlobalSlug` — see Payload globals below.
## Admin (import map) (`admin`, `branding`, `admin-ui`, `globals/SiteIntegrations`) — details: `node_modules/@intecion/ipal-kit/docs/white-label.md`, `…/docs/integrations.md`, `…/docs/email.md`, `…/docs/links.md`
@@ -155,7 +155,7 @@ Fifteen ready blocks and ten page templates. **Use a library block (or a variant
| `HeroBlock`, `TextMediaBlock`, `FeatureGridBlock`, `GalleryBlock`, `FaqBlock`, `CtaBlock`, `ContactBlock`, `TeamBlock`, `PricingBlock`, `LogosBlock`, `TestimonialsBlock`, `StatsBlock`, `RichTextBlock`, `StepsBlock`, `EntryListBlock` | `@intecion/ipal-kit/blocks/rsc` | The block components (server; props `LibraryBlockProps`: data + `locale`, `isFirst`, `ui`, `ctx`, `classNames`). |
| `HERO_PARTS`, `TEXT_MEDIA_PARTS`, `FEATURE_GRID_PARTS`, `GALLERY_PARTS`, `FAQ_PARTS`, `CTA_PARTS`, `CONTACT_PARTS`, `TEAM_PARTS`, `PRICING_PARTS`, `LOGOS_PARTS`, `TESTIMONIALS_PARTS`, `STATS_PARTS`, `RICH_TEXT_PARTS`, `STEPS_PARTS`, `ENTRY_LIST_PARTS` | `@intecion/ipal-kit/blocks/rsc` | Default token classes per block part — the keys of `classNames`. |
| `defaultEntryCard(doc)`, `defaultTestimonial(doc)` | `@intecion/ipal-kit/blocks/rsc` | Default mapping of a collection document to an entry card / a testimonial (`entryCard`, `mapTestimonial` replace them). |
| `Section`, `SECTION_BACKGROUNDS`, `SectionHeader`, `Media`, `CMSLink`, `Anchor`, `buttonClass`, `BUTTON_CLASSES`, `Container`, `CONTAINER_WIDTHS`, `Card`, `CARD_CLASS`, `CARD_INTERACTIVE_CLASS` | `@intecion/ipal-kit/blocks/rsc` | UI primitives, token utilities only: section (anchor, background, `data-surface`), heading group, image/video, panel link, link element, button looks, page column, card. |
| `Section`, `SECTION_BACKGROUNDS`, `SectionHeader`, `Media`, `CMSLink`, `Anchor`, `buttonClass`, `BUTTON_CLASSES`, `Container`, `CONTAINER_WIDTHS`, `Card`, `CARD_CLASS`, `CARD_INTERACTIVE_CLASS`, `CARD_INTERACTIVE_SHADOW_CLASS` | `@intecion/ipal-kit/blocks/rsc` | UI primitives, token utilities only: section (anchor, background, `data-surface`), heading group, image/video (`Media`: `priority`, `eager`, `sizes`, `videoMode`, `pauseForReducedMotion` — a background video paused for "reduce motion", default true), panel link, link element, button looks, page column, card (hover: an `::after` shadow layer fading with `opacity`; the 1.17 `box-shadow` transition is `CARD_INTERACTIVE_SHADOW_CLASS`). |
| `itemHeadingLevel(slug, props)`, `leadsWithImage(props)` | `@intecion/ipal-kit/blocks/rsc` | Item heading tag (one below the section heading; `h2` without one; `itemHeadings` overrides) and whether the block's first image is the page's LCP image (`isFirst` / `firstImage`; `priorityImage: false` turns it off). |
| `Buttons`, `headingId(block)`, `TitleLink`, `GRID_COLUMNS`, `cx`, `parts(defaults, overrides)` | `@intecion/ipal-kit/blocks/rsc` | Helpers for own blocks: button row, heading id for `aria-labelledby`, card title link (plain text when the link is dead), grid columns, class joining, part classes. |
| `BLOCK_TEXTS`, `blockTexts(locale, own?)`, `fillText(text, value)` | `@intecion/ipal-kit/blocks/rsc` | Visitor texts the blocks write (rating, step) in en/pl; override with `texts`. |
@@ -204,7 +204,7 @@ Fifteen ready blocks and ten page templates. **Use a library block (or a variant
| `readEffectiveConsent(version, gpc?)` | `@intecion/ipal-kit/client` | The stored choice under `version` with Global Privacy Control applied, read live from the cookie and `navigator` (not React state) — for your own tag loader's effects. |
| `signalVendors(prev, next)` / `clarityConsent(state)` | `@intecion/ipal-kit/client` | Tells the running Meta Pixel (`fbq('consent', …)`), TikTok (`ttq.revokeConsent` / `grantConsent`) and Clarity (`consentv2` / `consent false`) about a change; `useConsent` calls it on every decision — for your own banner. `clarityConsent` → Clarity's `{ ad_Storage, analytics_Storage }`. |
| `buildConsentLogCollection()` | `@intecion/ipal-kit` | Consent log collection (id, choices, version, time — no IP/personal data; proof of consent under GDPR Art. 7(1)). The plugin wires it itself with `consentLog: true` — do not call. |
| `buildConsentLogEndpoint({ retentionDays? })` | `@intecion/ipal-kit` | `POST /api/ipal/consent` endpoint that saves decisions and deletes records older than `retentionDays` (default 1095). The plugin wires it itself with `consentLog` — do not call. |
| `buildConsentLogEndpoint({ retentionDays? })` | `@intecion/ipal-kit` | `POST /api/ipal/consent` endpoint that saves decisions and deletes records older than `retentionDays` (default 1095). The plugin wires it itself with `consentLog` — do not call. On MongoDB a TTL index (`consentLog.ttlIndex`, default true) deletes them too, also without new records. |
**Built-in texts:** `CONSENT_FALLBACK`, `CONSENT_FALLBACK_PL`, `consentFallback(locale)` (banner defaults by page language), `CONSENT_CATEGORY_LABELS` / `consentCategoryOptions()` (category names `{ en, pl }`), `COOKIE_TABLE_LABELS` (`/rsc`, `<CookieTable locale>` defaults), `COOKIE_STORAGE_LABELS` (`/rsc`, type names per language).
@@ -401,6 +401,7 @@ Full option lists of `createContentHelpers` / `createPageRoute` / `SiteProviders
| `recordIntegrationStatus(payload, field, previous, { state, code?, message? })` | `@intecion/ipal-kit` | saves the state of your own integration in Site integrations (only on change / every 10 min); does not throw. For e-mail and Turnstile the plugin calls it itself — do not call |
| `buildIntegrationStatusField(name)` | `@intecion/ipal-kit` | hidden status group field (`state`, `code`, `message`, `since`, `checkedAt`) for `integrationsFields` |
| `buildIntegrationStatusBanner(statusField, label, texts?)` | `@intecion/ipal-kit` | UI field with a status banner on the integration tab (`label` string or `{ en, pl }`; `texts` = `{ failing, hint }` keys of your own `ipal` translations) (`integrationsFields`; then `pnpm generate:importmap`) |
| `UnusedMediaNotice`, `UNUSED_MEDIA_LINK_LIMIT` | `@intecion/ipal-kit/admin` | `iapl({ unusedMedia })` (1.18.0, opt-in): above an upload collection's list, how many files nothing uses (`findUnusedMedia` from `/doctor`) and a link to Payload's list filtered to them (first 100); editors and admins; deletes nothing; a hint only when the site is too big to check here |
| `IntegrationAlerts` | `@intecion/ipal-kit/admin` | dashboard alert about integrations in the `degraded` state; always injected by the plugin (`beforeDashboard`); your own integrations: a second instance with `checks`. By role: the detail (error text, link) for `details` and above (`'admin'` default, `'editor'`, `'all'`), a neutral "ask an administrator" for editors below it, nothing for others or for a session that owes its second factor (`dashboardAlerts.integrations`). `CookieCrawlAlert` takes `audience: 'editor' \| 'all'` the same way |
| `IntegrationStatusBanner` | `@intecion/ipal-kit/admin` | status banner on the tab; injected by the plugin / `buildIntegrationStatusBanner` through the import map (`pnpm generate:importmap`), the project does not import it |
@@ -431,10 +432,11 @@ The editor builds forms in the panel (Forms collection). The project does NOT wr
| Export | Import from | What it does / when |
|---|---|---|
| `RenderForm({ form, action, locale, texts, classNames?, values?, … })` | `@intecion/ipal-kit/rsc` | A panel form in a block in one line (RSC): renders message blocks and the confirmation, binds `sendForm` to the form and language, resolves the redirect, sends only `publicForm` to the browser; `form` not populated → nothing |
| `RenderForm({ form, action, locale, texts, classNames?, values?, Form?, turnstileReserveHeight?, … })` | `@intecion/ipal-kit/rsc` | A panel form in a block in one line (RSC): renders message blocks and the confirmation, binds `sendForm` to the form and language, resolves the redirect, sends only `publicForm` to the browser; `form` not populated → nothing. Renders the lazy `BuilderForm` (its code only on pages with a form, the HTML complete); `Form` swaps the component (the eager one from `/client/eager`); `turnstileReserveHeight` (default 73, 0 for an invisible widget) |
| `prepareBuilderForm({ form, action, locale, … })` | `@intecion/ipal-kit/rsc` | The server half of `RenderForm` without markup → `PreparedBuilderForm` (or `null`) to spread into `<BuilderForm>` in a client component (e.g. a configurator with changing `values`) |
| `publicForm(form)` | `@intecion/ipal-kit/rsc` | Public part of the form document (no Emails tab, no message rich text, safe redirect URL) — when you pass the form to the client yourself; never pass the raw document |
| `BuilderForm(props)` | `@intecion/ipal-kit/client` | Client renderer for any panel form (steps, all field types, Turnstile, honeypot, a11y), unstyled — look via `classNames`, field replacement via `renderField`; usually used indirectly through `RenderForm` |
| `BuilderForm(props)` | `@intecion/ipal-kit/client` | Client renderer for any panel form (steps, all field types, Turnstile, honeypot, a11y), unstyled — look via `classNames`, field replacement via `renderField`; usually used indirectly through `RenderForm`. Since 1.18.0 the `/client` export is a lazy wrapper with the same props (the code loads where a form is shown; SSR complete); `turnstileReserveHeight` keeps the widget's space |
| `BuilderForm`, `Turnstile` | `@intecion/ipal-kit/client/eager` | The same components without lazy loading — in every page's bundle. Only when a project needs them eager: `<RenderForm Form={BuilderForm}>` |
| `useBuilderForm({ form, action, texts, values?, onSuccess?, navigate?, redirectHref? })` | `@intecion/ipal-kit/client` | Panel form engine without markup (steps, `next/back/goTo`, per-step validation, server errors, redirect, analytics, `getInputProps`/`getSelectProps`/…, `TurnstileWidget`) — for your own markup of an unusual form |
### Pure panel form logic (client and server)
@@ -537,7 +539,8 @@ The editor builds forms in the panel (Forms collection). The project does NOT wr
| `MEDIA_SIZES` | `@intecion/ipal-kit` | Ready constant `sizes` values: `full`, `half`, `third`, `quarter`, `thumb` |
| `normalizeFilename(filename)` | `@intecion/ipal-kit` | Slugifies a file name, keeping the extension (`"Zdjęcie 1.JPG"` → `"zdjecie-1.jpg"`) |
| `normalizeFilenameHook` | `@intecion/ipal-kit` | `beforeOperation` hook for an upload collection (Media) that normalizes the file name; the project adds it to its Media collection |
| `buildOptimizeUploadHook(options?)` | `@intecion/ipal-kit` | `beforeOperation` hook: blocks oversized JPG/PNG/video, converts the image to WebP after the editor agrees (sharp from `buildConfig`); the project adds it to Media |
| `buildOptimizeUploadHook(options?)` | `@intecion/ipal-kit` | `beforeOperation` hook: blocks oversized JPG/PNG/video, converts the image to WebP after the editor agrees (sharp from `buildConfig`); removes the metadata of JPEG/PNG uploads that pass without re-encoding (`stripMetadata`, default true; 1.18.0); the project adds it to Media |
| `stripImageMetadata(buffer, mimeType)`, `exifOrientation(app1)` | `@intecion/ipal-kit` | Lossless metadata removal: JPEG APP1/APP13/COM, PNG tEXt/zTXt/iTXt/eXIf/tIME → `{ buffer, changed, orientation }` (the EXIF rotation, to apply before); anything unreadable comes back unchanged. Type `StripResult` |
| `buildOptimizeUploadField(name?)` | `@intecion/ipal-kit` | "Optimize this upload" consent checkbox (default `optimizeOnUpload`) for Media, paired with `buildOptimizeUploadHook` |
| `buildMediaPlaceholderHook({ field?, size? })` | `@intecion/ipal-kit` | `beforeOperation` hook that computes a tiny blur preview (base64 WebP) and the dominant colour on upload; the project adds it to Media |
| `buildMediaPlaceholderField(name?)` | `@intecion/ipal-kit` | Hidden field group for the placeholder (read by `mediaImageProps`), paired with `buildMediaPlaceholderHook` |
@@ -883,7 +886,10 @@ Bin: `iapl-doctor` (`pnpm exec iapl-doctor [dir] [--json] [--md] [--strict] [--f
| `runDeepProbe(ctx)` | `@intecion/ipal-kit/doctor` | `pnpm exec payload run …/dist/modules/doctor/probe.js` in the project → `DoctorStatus`. |
| `collectDoctorStatus(payload)` | `@intecion/ipal-kit/doctor` | Read-only counts: `usersWithout2fa`, `pendingCookies`, `media` (images over `IMAGE_RULES`, 1.18.0), `plugin`, `node`. |
| `PERF_BUDGETS`, `SERVER_BUDGET`, `perfBudgets(overrides)`, `overBudget(measured, budget)`, `IMAGE_RULES` | `@intecion/ipal-kit/doctor` | Performance budgets (1.18.0, performance.md): the defaults per profile (`mobile`, `desktop`: `lcp`, `cls`, `inp`, `tbt`, `jsBytes`, `cssBytes`, `fontBytes`, `requests`, `renderBlocking`, `thirdParty`) and per render (`queriesPerRender`); a project's own on top; the broken budgets of one measurement as lines (empty = within budget); the image limits (1.5 MB, 2560 px, AVIF/WebP). Types `PerfBudget`, `PerfMeasurement`, `PerfProfile`, `ServerBudget`. The gate: `iapl-performance/resources/performance.spec.template.ts` + `perf-lab.mjs`. |
| `collectGrowth(payload)` → `GrowthStatus`, `growthRules`, `GROWTH_DEFAULTS`, `folderBytes(dir)` | `@intecion/ipal-kit/doctor` | What grows (1.18.0, performance.md §6): per collection documents, bytes (MongoDB) and the oldest record; versions per collection and global with their limit; `payload-kv` entries and expired ones; media no document points at (first 5000 documents) — counts only. The `growth` rules (`growth-size`, `-versions`, `-retention`, `-submissions`, `-kv`, `-media`, `-disk`) and their default thresholds (`iapl-doctor.json` → `growth`, type `GrowthThresholds`). |
| `findUnusedMedia(payload, { limit?, only? })` → `UnusedMedia \| null` | `@intecion/ipal-kit/doctor` | Media of the upload collections no document or global mentions — by id or by file name in a text; `{ byCollection, checked, complete, total }`; reads only. The panel notice lists them only when `complete` |
| `syncTtlIndex(payload, slug, { days, enabled, from })`, `ttlField()`, `TTL_FIELD`, `TTL_INDEX`, `isMongo(config)` | `@intecion/ipal-kit` | The MongoDB TTL index the plugin keeps for the consent log and statistics (1.18.0): created / moved to the current retention (`collMod`) / dropped; records backfilled once from `from`. For a log collection of your own: add `ttlField()`, call it in `onInit`. Type `TtlSyncResult` |
| `withVersionLimit(entity, 'collection' \| 'global', limit?)`, `PLUGIN_VERSION_LIMIT` | `@intecion/ipal-kit` | A collection or global whose versions are on without a limit gets `maxPerDoc` / `max` (default 20); a limit already set wins. iapl() applies it to its own entities |
| `collectGrowth(payload)` → `GrowthStatus`, `growthRules`, `GROWTH_DEFAULTS`, `folderBytes(dir)` | `@intecion/ipal-kit/doctor` | What grows (1.18.0, performance.md §6): per collection documents, bytes (MongoDB) and the oldest record; versions per collection and global with their limit; `payload-kv` entries and expired ones; media no document points at (first 5000 documents) — counts only. The `growth` rules (`growth-size`, `-versions`, `-versions-config`, `-retention`, `-submissions`, `-kv`, `-media`, `-disk`) and their default thresholds (`iapl-doctor.json` → `growth`, type `GrowthThresholds`). |
| `performanceRules` | `@intecion/ipal-kit/doctor` | The doctor's `performance` group (`perf-images-config`, `perf-fonts`, `perf-render-blocking`, `perf-embeds`, `perf-animations`, `perf-budgets`, `perf-live`, `perf-images`) — part of `doctorRules`. |
| `buildDoctorEndpoint({ tokenVar, access })` | `@intecion/ipal-kit/doctor` | `GET /ipal/doctor` (`/api/ipal/doctor`): 404 until the token variable (default `IAPL_DOCTOR_TOKEN`, ≥ 32 chars) is set, Bearer token or `access`, rate-limited. Added by `iapl` unless `doctor: false`. |
| `jobsRunAccess({ secretVar? })` | `@intecion/ipal-kit` | The rule iapl puts on `jobs.access.run` when the project writes none: `cronSecretMatches(req, process.env[secretVar])` or an admin with the second factor. Reuse it in your own rule: `run: (a) => jobsRunAccess()(a) \|\| myCheck(a)`. Type `JobsRunAccessOptions`. |
+4 -1
View File
@@ -180,7 +180,10 @@ plugin's components. `content` needs `resolveLink`; `getEntries` (entry list), `
`CMSLink` (a panel link → `Anchor`, with `buttonClass`; a link that wraps something — a logo, a card — and leads nowhere
keeps its content without a link, so an empty link group never hides it),
`buttonClass` / `BUTTON_CLASSES` (button looks by appearance), `Container` / `CONTAINER_WIDTHS`, `Card` / `CARD_CLASS` /
`CARD_INTERACTIVE_CLASS`. Helpers for the project's own blocks: `Buttons` (a block's button row), `headingId(block)`
`CARD_INTERACTIVE_CLASS` (1.18.0: the hover lift fades an `::after` shadow layer with `opacity` — drawn by the
compositor, no repaint per frame; the 1.17 `box-shadow` transition is `CARD_INTERACTIVE_SHADOW_CLASS`). `Media` pauses
a background video for visitors with "reduce motion" (`pauseForReducedMotion={false}` turns that off) and takes `eager`
for an image above the fold that is not the LCP image. Helpers for the project's own blocks: `Buttons` (a block's button row), `headingId(block)`
(the heading id for `aria-labelledby`), `TitleLink` (a card title that links when its link resolves), `GRID_COLUMNS`,
`cx`, `parts(defaults, overrides)`, `itemHeadingLevel(slug, props)` (the item heading tag) and `leadsWithImage(props)`
(whether the block's first image is the LCP image).
+2 -1
View File
@@ -617,8 +617,9 @@ to add the hook to a config. Nothing to migrate.
| Item | Value |
|---|---|
| Option | `consentLog?: boolean \| { retentionDays?: number; collectionOverrides?: CollectionOverride }` (type `ConsentLogOptions`) |
| Option | `consentLog?: boolean \| { retentionDays?: number; ttlIndex?: boolean; collectionOverrides?: CollectionOverride }` (type `ConsentLogOptions`) |
| `retentionDays` | default `1095` (3 years) |
| `ttlIndex` | 1.18.0, MongoDB: default `true` — a TTL index (`iapl_ttl` on the hidden date `iaplTtlFrom`) deletes records older than `retentionDays` by itself, also when no new record comes; kept at the current retention at every start; `false` drops it at the next start (the purge after a new record stays). Postgres / SQLite: not used, no column |
| `collectionOverrides` | changes `consent-records`: an object merges `access` / `admin` / `hooks` key by key (your keys win), other keys replace; a function `(collection) => collection` takes over (keep the slug — the endpoint writes to it) |
| Collection | `consent-records` (`CONSENT_LOG_SLUG`), group *Privacy*; fields `consentId` (index), `version`, `choices.{necessary,functional,analytics,marketing}`, `createdAt` |
| Collection access | `read` / `delete` — admin (without `access`, i.e. no roles: any logged-in account — narrow it with `collectionOverrides`); `create` / `update` — nobody through the API (written only by the endpoint, `overrideAccess`) |
+35 -41
View File
@@ -73,6 +73,22 @@ less JS and nothing new blocks: Turbopack splits the client chunks differently o
client boundary, and on that line the order of downloads moves the stylesheet a little. The fonts are the bigger
lever (decision 2 below: −36 to −52 ms).
### The owner's items (second branch, from main 076b3ef): before → after, median of 3
| | webpack | Turbopack |
|---|---|---|
| JS per page without a form (compressed) | 188.1 → 179.3 KB | 181.6 → 175.5 KB |
| JS on a page with a form (the form's chunk loads there) | 188.1 → 187.7 KB | 181.6 → 183.6 KB |
| JS on the showcase (every block) | 216.4 → 218.7 KB | 209.9 → 214.0 KB |
| LCP phone, pages | 796–848 → 740–776 ms | 820–868 → 780–820 ms |
| LCP desktop, pages | 280–304 → 272–288 ms | 288–308 → 276–292 ms |
| 404 phone: LCP / CLS | 2.52 s / 0.319 → 1.84 s / 0 | 2.31 s / 0.319 → 1.72 s / 0 |
| CLS home (the headings swap to their font) | 0.036 → 0.036 | 0 → 0.036 |
| Queries per render | unchanged (19–27) | unchanged |
Raw: `webpack-1180-before.json`, `webpack-1180-after.json`, `turbopack-1180-after.json` (Turbopack "before" =
`turbopack-after.json` of the first branch).
## Audit — what the plugin does, file and line, and the gain of each fix
Sources: web.dev (vitals, optimize-lcp, cls, optimize-inp, font-best-practices, animations-guide,
@@ -109,37 +125,18 @@ conversion (metadata dropped); `YouTubeEmbed` is a facade; Meta, LinkedIn, TikTo
the proxy does no database work; the 434 KB cookie database is loaded only by a scan; the sitemap has `select` and a
300 s memo.
### For the owner — yes / no (gain and cost)
1. **Lazy 404 content (CLS 0.32, LCP 2.5 s on a phone).** The 404 is fetched by a server action after hydration
so that every page's payload does not carry it (pages.md). Options: (a) keep, and have the reference site set a
`placeholder` of its 404 height — CLS → 0, LCP unchanged, a number to keep in sync with the content; (b) render
the 404 eagerly — LCP and CLS as any page, but every page's HTML grows by the 404 content in every language
(pages.md: a two-language home page as the 404 made a page 195 KB gzip instead of 146 KB). Recommendation (a).
2. **Fonts: 209.5 KB, four preloaded files** (Inter + Fraunces, latin + latin-ext). Each variable family has two
subset files. Measured (Turbopack, phone, median of 5): Fraunces with `preload: false` → first paint and LCP
−36 to −52 ms on home, page and post; the same 209 KB still downloads (the headings use it), and the home page's
CLS goes from 0 to 0.036 (the headings swap, < 0.1). One family instead of two would save ~70 KB as well. A design
decision for the reference site and the starter default. Recommendation: `preload: false` on the heading font.
3. **Form code on every page (≈ 10 KB compressed).** The catch-all route renders any block, so the contact form's
client code (BuilderForm, Turnstile provider) is in every page's bundle. A `lazy()` wrapper would load it only on
pages with a form; SSR stays complete. Gain −10 KB on most pages; cost: a hydration wait on the form, test effort
with both bundlers. Recommendation: yes, next release.
4. **Background video and reduced motion.** `Media` (a server component) cannot know the visitor's setting, so a
background video autoplays for everyone (`block-library/ui/Media.tsx:29`). A small client wrapper pausing it with
`prefers-reduced-motion` adds ~1 KB to pages with a video. Recommendation: yes.
5. **Consent Mode `basic` as the default** (no request to Google before consent; already pending as a security
decision). Speed gain on a first visit with GA/GTM set: one third-party origin and ~100 KB of tag less until consent.
6. **Card hover animates `box-shadow`** (`block-library/ui/Card.tsx:6`, a paint per frame, cheap on cards). A
pseudo-element with `opacity` would be compositor-only; the hover looks the same. Low gain; yes if the block
library is touched anyway.
7. **Upload variants (`imageSizes`) and metadata on originals.** next/image already resizes and converts on request,
so stored variants mostly help the lightbox `srcSet` and R2 egress; originals under the 1.5 MB limit keep their
EXIF (camera, possibly GPS). Stripping metadata on every upload re-encodes the original. Recommendation: strip
metadata on upload for JPEG/PNG (privacy more than speed), variants no.
8. **Doctor performance rules: warnings now, errors later?** In 1.18.0 they warn (as asked); `perf-live`
uncompressed HTML and `perf-images` could become errors in 1.19.0.
### The owner's decisions (2026-12-01) — all in 1.18.0
| # | Item | Decision | What was built (measured on the reference site) |
|---|---|---|---|
| 1 | Lazy 404 moves the footer (CLS 0.319, LCP 2.5 s on a phone) | yes (a) | the reference `not-found.tsx` passes a `placeholder` of its content's height (`max(290px, calc(212px + 11.5vw))`, measured 360–1920 px): CLS 0.319 → 0, LCP 2.52 → 1.90 s |
| 2 | Heading font preloaded (four font files compete with the stylesheet) | yes | `preload: false` on Fraunces in the reference layout, and so in every new site (`iapl create` keeps the call's options): phone LCP −36 to −52 ms; home CLS stays 0.036 |
| 3 | Form code on every page | yes | `BuilderForm` / `Turnstile` from `/client` are lazy wrappers (same props; the server renders the whole form); the hooks behind them lost a needless `'use client'` (each was a client boundary the entry shipped); eager ones in `@intecion/ipal-kit/client/eager`, `RenderForm Form={…}`: −8.8 KB (webpack) / −6.1 KB (Turbopack) gzip on every page without a form; a form page loads the form's chunk as before. Found on the way: the Turnstile widget (72.6 px) appeared in an empty box and moved the form — its height is now kept (73 px, `turnstileReserveHeight`) |
| 4 | Background video ignores reduced motion | yes | `BackgroundVideo` (client) pauses it after hydration for `prefers-reduced-motion`, follows a change; `Media pauseForReducedMotion={false}` |
| 5 | Consent Mode `basic` as default | **no** (stays `advanced`) | — |
| 6 | Card hover animates `box-shadow` | yes | an `::after` shadow layer fades with `opacity`; `CARD_INTERACTIVE_SHADOW_CLASS` = the 1.17 class |
| 7 | Metadata on uploads | yes, no stored variants | lossless strip of JPEG APP1/APP13/COM and PNG text/eXIf/tIME (pixels and ICC byte for byte), EXIF rotation applied once; `stripMetadata: false` |
| 8 | Doctor warnings → errors | **open** (warnings stay) | — |
## Growth review (owner's addition, 2026-12-01): what swells the site and its database
Measured on the reference site (MongoDB 7) after the full reference suite as traffic: 15 collections, the largest
@@ -163,18 +160,15 @@ retention; 1 of 17 media unused — `logo-example-studio-1.webp`, a duplicate lo
Postgres / SQLite: the same purges through Drizzle's `deleteMany`; no TTL indexes; sizes not read (counts only).
### Growth — for the owner (yes / no)
### Growth — the owner's decisions (2026-12-01)
9. **A default retention for form submissions** (e.g. 365 days) on every site, existing ones included. Deletes
data on live sites on their next submission. Recommendation: no default; the agent asks the client
(`submissionRetentionDays`) and the doctor reports sites without one — or yes with 730 days and a loud upgrade note.
10. **MongoDB TTL indexes** for the consent log and statistics (expire `createdAt` / `lastAt` after the retention),
so the purge runs even when no new record comes. Same records deleted as today, sooner on a quiet site; one index
build per site at start. Recommendation: yes for 1.19.0 (opt-out), Mongo only.
11. **Delete `gone` cookie-review rows after a year.** Deletes the scanner's history. Recommendation: no.
12. **A media clean-up action in the panel** (list the unused media, delete after confirmation). Recommendation:
yes, as a panel view — never automatic.
13. **`maxPerDoc: 20`** in the reference and the starter wherever versions get turned on (none today). Recommendation: yes (no data deleted until a document is saved again).
| # | Item | Decision | What was built |
|---|---|---|---|
| 9 | A default retention for form submissions | **no** | the opt-in `forms.submissionRetentionDays` stays; the doctor reports sites without one |
| 10 | MongoDB TTL indexes for the consent log and statistics | yes | `iapl_ttl` on a hidden `iaplTtlFrom` (Payload's own `createdAt` index cannot become a TTL one: Mongoose recreates it at every start — tested, IndexOptionsConflict); backfilled once from `createdAt` / `lastAt`, kept at the current `retentionDays` by `collMod` at every start; `ttlIndex: false` drops it; Postgres / SQLite unchanged. Checked in the reference gate against the real database |
| 11 | Delete `gone` cookie-review rows | **no** | — |
| 12 | Review and delete unused media in the panel | yes, manual, optional | `iapl({ unusedMedia: true })`: a notice above each upload list with a link to Payload's list filtered to the unused files (by id or by file name in a text; nothing listed when the site is too big to check every document there); deleting is Payload's bulk delete. Off by default (it adds an import-map entry); the reference site has it on; e2e `unused-media.spec.ts` |
| 13 | `maxPerDoc: 20` where versions are on | yes | the plugin's collections and globals whose versions a project turns on get 20 unless the project sets a limit; the doctor's `growth-versions-config` hints the project's own collections. Neither the plugin nor the reference site turns versions on |
### Shared with IAWL
+770
View File
@@ -0,0 +1,770 @@
{
"client": {
"mobile": {
"home": {
"bytes": {
"css": 12161,
"font": 209501,
"html": 19936,
"image": 9544,
"js": 175539,
"other": 0
},
"cls": 0.036,
"fcp": 812,
"inp": 40,
"interaction": "PL",
"lcp": 812,
"lcpElement": {
"fetchpriority": "high",
"loading": "eager",
"src": "data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 1000'%3",
"tag": "img"
},
"load": 2365,
"prefetches": 4,
"profile": "mobile",
"renderBlocking": [
"/_next/static/chunks/3_r2-9g9f0xzb.css"
],
"requests": 22,
"scriptMs": 80,
"status": 200,
"tbt": 7,
"thirdParty": [],
"ttfb": 151,
"url": "/pl",
"runs": 3
},
"page": {
"bytes": {
"css": 12161,
"font": 209501,
"html": 17074,
"image": 8457,
"js": 175539,
"other": 0
},
"cls": 0,
"fcp": 784,
"inp": 32,
"interaction": "PL",
"lcp": 784,
"lcpElement": {
"fetchpriority": "high",
"loading": "eager",
"src": "data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 1000'%3",
"tag": "img"
},
"load": 2374,
"prefetches": 2,
"profile": "mobile",
"renderBlocking": [
"/_next/static/chunks/3_r2-9g9f0xzb.css"
],
"requests": 19,
"scriptMs": 69,
"status": 200,
"tbt": 6,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/o-nas",
"runs": 3
},
"archive": {
"bytes": {
"css": 12161,
"font": 209501,
"html": 16563,
"image": 5322,
"js": 175539,
"other": 0
},
"cls": 0,
"fcp": 780,
"inp": 40,
"interaction": "PL",
"lcp": 780,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 2365,
"prefetches": 3,
"profile": "mobile",
"renderBlocking": [
"/_next/static/chunks/3_r2-9g9f0xzb.css"
],
"requests": 19,
"scriptMs": 75,
"status": 200,
"tbt": 5,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/blog",
"runs": 3
},
"post": {
"bytes": {
"css": 12161,
"font": 209501,
"html": 17107,
"image": 5322,
"js": 175539,
"other": 0
},
"cls": 0,
"fcp": 792,
"inp": 40,
"interaction": "PL",
"lcp": 792,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 2381,
"prefetches": 2,
"profile": "mobile",
"renderBlocking": [
"/_next/static/chunks/3_r2-9g9f0xzb.css"
],
"requests": 19,
"scriptMs": 76,
"status": 200,
"tbt": 6,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/blog/zanim-kupisz-dzialke",
"runs": 3
},
"caseStudy": {
"bytes": {
"css": 12161,
"font": 209501,
"html": 16528,
"image": 4376,
"js": 175539,
"other": 0
},
"cls": 0,
"fcp": 800,
"inp": 40,
"interaction": "PL",
"lcp": 800,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 2385,
"prefetches": 2,
"profile": "mobile",
"renderBlocking": [
"/_next/static/chunks/3_r2-9g9f0xzb.css"
],
"requests": 18,
"scriptMs": 78,
"status": 200,
"tbt": 8,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/realizacje/dom-pod-lasem",
"runs": 3
},
"form": {
"bytes": {
"css": 12161,
"font": 209501,
"html": 16819,
"image": 0,
"js": 183565,
"other": 0
},
"cls": 0,
"fcp": 800,
"inp": 32,
"interaction": "PL",
"lcp": 800,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 2551,
"prefetches": 2,
"profile": "mobile",
"renderBlocking": [
"/_next/static/chunks/3_r2-9g9f0xzb.css"
],
"requests": 17,
"scriptMs": 88,
"status": 200,
"tbt": 7,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/wycena",
"runs": 3
},
"showcase": {
"bytes": {
"css": 12161,
"font": 209501,
"html": 37329,
"image": 2018,
"js": 214068,
"other": 0
},
"cls": 0,
"fcp": 820,
"inp": 40,
"interaction": "PL",
"lcp": 820,
"lcpElement": {
"fetchpriority": "high",
"loading": "eager",
"src": "data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 1000'%3",
"tag": "img"
},
"load": 2384,
"prefetches": 4,
"profile": "mobile",
"renderBlocking": [
"/_next/static/chunks/3_r2-9g9f0xzb.css"
],
"requests": 23,
"scriptMs": 161,
"status": 200,
"tbt": 10,
"thirdParty": [
"https://challenges.cloudflare.com"
],
"ttfb": 151,
"url": "/pl/bloki",
"runs": 3
},
"notFound": {
"bytes": {
"css": 12161,
"font": 209501,
"html": 7740,
"image": 0,
"js": 175539,
"other": 2380
},
"cls": 0,
"fcp": 1724,
"inp": 32,
"interaction": "PL",
"lcp": 1724,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 2789,
"prefetches": 10,
"profile": "mobile",
"renderBlocking": [],
"requests": 17,
"scriptMs": 118,
"status": 404,
"tbt": 0,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/nie-ma-takiej-strony",
"runs": 3
}
},
"desktop": {
"home": {
"bytes": {
"css": 12161,
"font": 209501,
"html": 19936,
"image": 9286,
"js": 175539,
"other": 0
},
"cls": 0.001,
"fcp": 288,
"inp": 40,
"interaction": "PL",
"lcp": 288,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "h1"
},
"load": 464,
"prefetches": 11,
"profile": "desktop",
"renderBlocking": [
"/_next/static/chunks/3_r2-9g9f0xzb.css"
],
"requests": 22,
"scriptMs": 38,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl",
"runs": 3
},
"page": {
"bytes": {
"css": 12161,
"font": 209501,
"html": 17074,
"image": 10684,
"js": 175539,
"other": 0
},
"cls": 0,
"fcp": 284,
"inp": 40,
"interaction": "PL",
"lcp": 284,
"lcpElement": {
"fetchpriority": "high",
"loading": "eager",
"src": "/_next/image?url=http%3A%2F%2Flocalhost%3A3370%2Fapi%2Fmedia%2Ffile%2Flibrary-3.webp&w=750&q=75",
"tag": "img"
},
"load": 444,
"prefetches": 8,
"profile": "desktop",
"renderBlocking": [
"/_next/static/chunks/3_r2-9g9f0xzb.css"
],
"requests": 20,
"scriptMs": 18,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/o-nas",
"runs": 3
},
"archive": {
"bytes": {
"css": 12161,
"font": 209501,
"html": 16563,
"image": 4815,
"js": 175539,
"other": 0
},
"cls": 0,
"fcp": 276,
"inp": 40,
"interaction": "PL",
"lcp": 276,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 454,
"prefetches": 11,
"profile": "desktop",
"renderBlocking": [
"/_next/static/chunks/3_r2-9g9f0xzb.css"
],
"requests": 19,
"scriptMs": 32,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/blog",
"runs": 3
},
"post": {
"bytes": {
"css": 12161,
"font": 209501,
"html": 17107,
"image": 4815,
"js": 175539,
"other": 0
},
"cls": 0,
"fcp": 276,
"inp": 40,
"interaction": "PL",
"lcp": 276,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 437,
"prefetches": 8,
"profile": "desktop",
"renderBlocking": [
"/_next/static/chunks/3_r2-9g9f0xzb.css"
],
"requests": 19,
"scriptMs": 20,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/blog/zanim-kupisz-dzialke",
"runs": 3
},
"caseStudy": {
"bytes": {
"css": 12161,
"font": 209501,
"html": 16528,
"image": 9286,
"js": 175539,
"other": 0
},
"cls": 0,
"fcp": 292,
"inp": 40,
"interaction": "PL",
"lcp": 292,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "h1"
},
"load": 445,
"prefetches": 8,
"profile": "desktop",
"renderBlocking": [
"/_next/static/chunks/3_r2-9g9f0xzb.css"
],
"requests": 20,
"scriptMs": 19,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/realizacje/dom-pod-lasem",
"runs": 3
},
"form": {
"bytes": {
"css": 12161,
"font": 209501,
"html": 16819,
"image": 0,
"js": 183565,
"other": 0
},
"cls": 0,
"fcp": 280,
"inp": 40,
"interaction": "PL",
"lcp": 280,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 492,
"prefetches": 8,
"profile": "desktop",
"renderBlocking": [
"/_next/static/chunks/3_r2-9g9f0xzb.css"
],
"requests": 17,
"scriptMs": 39,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/wycena",
"runs": 3
},
"showcase": {
"bytes": {
"css": 12161,
"font": 209501,
"html": 37329,
"image": 5267,
"js": 214011,
"other": 0
},
"cls": 0,
"fcp": 288,
"inp": 40,
"interaction": "PL",
"lcp": 288,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 447,
"prefetches": 8,
"profile": "desktop",
"renderBlocking": [
"/_next/static/chunks/3_r2-9g9f0xzb.css"
],
"requests": 24,
"scriptMs": 42,
"status": 200,
"tbt": 0,
"thirdParty": [
"https://challenges.cloudflare.com"
],
"ttfb": 41,
"url": "/pl/bloki",
"runs": 3
},
"notFound": {
"bytes": {
"css": 12161,
"font": 209501,
"html": 7740,
"image": 0,
"js": 175539,
"other": 2380
},
"cls": 0,
"fcp": 392,
"inp": 40,
"interaction": "PL",
"lcp": 444,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "h1"
},
"load": 518,
"prefetches": 14,
"profile": "desktop",
"renderBlocking": [],
"requests": 17,
"scriptMs": 34,
"status": 404,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/nie-ma-takiej-strony",
"runs": 3
}
},
"admin": {
"bytes": {
"css": 98914,
"font": 0,
"html": 24294,
"image": 0,
"js": 876299,
"other": 1690
},
"cls": 0,
"fcp": 1048,
"inp": null,
"interaction": null,
"lcp": 1048,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "a"
},
"load": 970,
"prefetches": 0,
"profile": "desktop",
"renderBlocking": [
"/_next/static/chunks/3ebvnk7qs9043.css",
"/_next/static/chunks/1l9apu4iesvci.css",
"/_next/static/chunks/3c_6gydv624zb.css",
"/_next/static/chunks/2h0ajyj_brp--.css",
"/_next/static/chunks/3k6de-uhqm-in.css",
"/_next/static/chunks/2do7kfo662xwp.css",
"/_next/static/chunks/1z_mbvpkjhpd5.css"
],
"requests": 23,
"scriptMs": 411,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 85,
"url": "/admin/login",
"runs": 3
}
},
"date": "2026-12-01T14:43:52.891Z",
"label": "turbopack-1180-after",
"method": "scripts/perf-measure.mjs + reference/e2e/perf-lab.mjs",
"runs": 3,
"server": {
"coldStartHealthMs": 1081,
"coldStartFirstPageMs": 1101,
"firstPageMs": 18,
"ttfb_home": {
"median": 3,
"p95": 4.7
},
"ttfb_md": {
"median": 23.7,
"p95": 38.1
},
"ttfb_sitemap": {
"median": 1.6,
"p95": 2.6
},
"ttfb_llms": {
"median": 27.7,
"p95": 42.4
},
"render": {
"home": {
"medianMs": 39.6,
"queries": 24,
"queryMs": 0,
"byCollection": {
"globals": 27,
"pages": 33,
"media": 9,
"forms": 3
}
},
"page": {
"medianMs": 29.9,
"queries": 21,
"queryMs": 0,
"byCollection": {
"globals": 27,
"media": 6,
"pages": 27,
"forms": 3
}
},
"archive": {
"medianMs": 30.1,
"queries": 23,
"queryMs": 0,
"byCollection": {
"globals": 27,
"pages": 27,
"media": 6,
"forms": 3,
"posts": 6
}
},
"post": {
"medianMs": 27.9,
"queries": 26,
"queryMs": 0,
"byCollection": {
"globals": 27,
"media": 9,
"pages": 24,
"posts": 15,
"forms": 3
}
},
"caseStudy": {
"medianMs": 25.7,
"queries": 22,
"queryMs": 0,
"byCollection": {
"globals": 27,
"pages": 21,
"media": 6,
"casestudies": 9,
"forms": 3
}
},
"form": {
"medianMs": 23.7,
"queries": 19,
"queryMs": 0,
"byCollection": {
"globals": 27,
"media": 3,
"pages": 24,
"forms": 3
}
},
"showcase": {
"medianMs": 48.9,
"queries": 27,
"queryMs": 0,
"byCollection": {
"globals": 24,
"pages": 33,
"media": 12,
"forms": 6,
"posts": 6
}
},
"notFound": {
"medianMs": 31.3,
"queries": 20,
"queryMs": 0,
"byCollection": {
"globals": 27,
"pages": 27,
"media": 6
}
},
"md": {
"medianMs": 25,
"queries": 16,
"queryMs": 0,
"byCollection": {
"globals": 4,
"media": 5,
"pages": 6,
"forms": 1
}
},
"sitemap": {
"medianMs": 2,
"queries": 0,
"queryMs": 0,
"byCollection": {}
},
"llms": {
"medianMs": 40,
"queries": 22,
"queryMs": 0,
"byCollection": {
"globals": 4,
"media": 3,
"pages": 7,
"posts": 4,
"casestudies": 4
}
},
"llmsFull": {
"medianMs": 58,
"queries": 38,
"queryMs": 0,
"byCollection": {
"globals": 6,
"media": 9,
"pages": 13,
"forms": 2,
"posts": 4,
"casestudies": 4
}
}
},
"rssMiB": 472
}
}
+153 -153
View File
@@ -5,14 +5,14 @@
"bytes": {
"css": 11177,
"font": 209501,
"html": 19948,
"html": 19887,
"image": 9544,
"js": 188341,
"js": 179297,
"other": 0
},
"cls": 0.036,
"fcp": 768,
"inp": 32,
"inp": 40,
"interaction": "PL",
"lcp": 768,
"lcpElement": {
@@ -21,16 +21,16 @@
"src": "data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 1000'%3",
"tag": "img"
},
"load": 2432,
"load": 2374,
"prefetches": 4,
"profile": "mobile",
"renderBlocking": [
"/_next/static/css/b2d8ea1877879cf5.css"
],
"requests": 22,
"scriptMs": 126,
"requests": 21,
"scriptMs": 132,
"status": 200,
"tbt": 14,
"tbt": 20,
"thirdParty": [],
"ttfb": 151,
"url": "/pl",
@@ -40,32 +40,32 @@
"bytes": {
"css": 11177,
"font": 209501,
"html": 17081,
"html": 17027,
"image": 8457,
"js": 188341,
"js": 179297,
"other": 0
},
"cls": 0,
"fcp": 756,
"inp": 32,
"fcp": 752,
"inp": 40,
"interaction": "PL",
"lcp": 756,
"lcp": 752,
"lcpElement": {
"fetchpriority": "high",
"loading": "eager",
"src": "data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 1000'%3",
"tag": "img"
},
"load": 2435,
"load": 2373,
"prefetches": 2,
"profile": "mobile",
"renderBlocking": [
"/_next/static/css/b2d8ea1877879cf5.css"
],
"requests": 19,
"scriptMs": 126,
"requests": 18,
"scriptMs": 125,
"status": 200,
"tbt": 12,
"tbt": 21,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/o-nas",
@@ -75,9 +75,9 @@
"bytes": {
"css": 11177,
"font": 209501,
"html": 16640,
"html": 16588,
"image": 5322,
"js": 188341,
"js": 179297,
"other": 0
},
"cls": 0,
@@ -91,16 +91,16 @@
"src": null,
"tag": "p"
},
"load": 2437,
"load": 2378,
"prefetches": 3,
"profile": "mobile",
"renderBlocking": [
"/_next/static/css/b2d8ea1877879cf5.css"
],
"requests": 19,
"scriptMs": 130,
"requests": 18,
"scriptMs": 126,
"status": 200,
"tbt": 14,
"tbt": 20,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/blog",
@@ -110,32 +110,32 @@
"bytes": {
"css": 11177,
"font": 209501,
"html": 17135,
"html": 17071,
"image": 5322,
"js": 188341,
"js": 179297,
"other": 0
},
"cls": 0,
"fcp": 752,
"fcp": 744,
"inp": 40,
"interaction": "PL",
"lcp": 752,
"lcp": 744,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 2435,
"load": 2374,
"prefetches": 2,
"profile": "mobile",
"renderBlocking": [
"/_next/static/css/b2d8ea1877879cf5.css"
],
"requests": 19,
"scriptMs": 137,
"requests": 18,
"scriptMs": 121,
"status": 200,
"tbt": 15,
"tbt": 21,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/blog/zanim-kupisz-dzialke",
@@ -145,9 +145,9 @@
"bytes": {
"css": 11177,
"font": 209501,
"html": 16540,
"html": 16486,
"image": 4376,
"js": 188341,
"js": 179297,
"other": 0
},
"cls": 0,
@@ -161,16 +161,16 @@
"src": null,
"tag": "p"
},
"load": 2442,
"load": 2373,
"prefetches": 2,
"profile": "mobile",
"renderBlocking": [
"/_next/static/css/b2d8ea1877879cf5.css"
],
"requests": 18,
"scriptMs": 129,
"requests": 17,
"scriptMs": 119,
"status": 200,
"tbt": 15,
"tbt": 19,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/realizacje/dom-pod-lasem",
@@ -180,14 +180,14 @@
"bytes": {
"css": 11177,
"font": 209501,
"html": 16793,
"html": 16753,
"image": 0,
"js": 188341,
"js": 187749,
"other": 0
},
"cls": 0,
"fcp": 776,
"inp": 40,
"inp": 32,
"interaction": "PL",
"lcp": 776,
"lcpElement": {
@@ -196,16 +196,16 @@
"src": null,
"tag": "p"
},
"load": 2380,
"load": 2565,
"prefetches": 2,
"profile": "mobile",
"renderBlocking": [
"/_next/static/css/b2d8ea1877879cf5.css"
],
"requests": 16,
"scriptMs": 215,
"scriptMs": 151,
"status": 200,
"tbt": 13,
"tbt": 15,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/wycena",
@@ -215,32 +215,32 @@
"bytes": {
"css": 11177,
"font": 209501,
"html": 37303,
"html": 37304,
"image": 2018,
"js": 216609,
"js": 218738,
"other": 0
},
"cls": 0,
"fcp": 768,
"fcp": 760,
"inp": 40,
"interaction": "PL",
"lcp": 768,
"lcp": 760,
"lcpElement": {
"fetchpriority": "high",
"loading": "eager",
"src": "data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 1000'%3",
"tag": "img"
},
"load": 2459,
"load": 2415,
"prefetches": 4,
"profile": "mobile",
"renderBlocking": [
"/_next/static/css/b2d8ea1877879cf5.css"
],
"requests": 21,
"scriptMs": 205,
"requests": 22,
"scriptMs": 213,
"status": 200,
"tbt": 21,
"tbt": 23,
"thirdParty": [
"https://challenges.cloudflare.com"
],
@@ -252,28 +252,28 @@
"bytes": {
"css": 11177,
"font": 209501,
"html": 7711,
"html": 7677,
"image": 0,
"js": 188341,
"other": 2472
"js": 179297,
"other": 2450
},
"cls": 0,
"fcp": 1900,
"inp": 40,
"fcp": 1836,
"inp": 32,
"interaction": "PL",
"lcp": 1900,
"lcp": 1836,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 2845,
"load": 2802,
"prefetches": 10,
"profile": "mobile",
"renderBlocking": [],
"requests": 17,
"scriptMs": 172,
"requests": 16,
"scriptMs": 167,
"status": 404,
"tbt": 0,
"thirdParty": [],
@@ -287,30 +287,30 @@
"bytes": {
"css": 11177,
"font": 209501,
"html": 19948,
"html": 19887,
"image": 9286,
"js": 188341,
"js": 179297,
"other": 0
},
"cls": 0.001,
"fcp": 284,
"fcp": 280,
"inp": 40,
"interaction": "PL",
"lcp": 284,
"lcp": 280,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "h1"
},
"load": 477,
"load": 463,
"prefetches": 11,
"profile": "desktop",
"renderBlocking": [
"/_next/static/css/b2d8ea1877879cf5.css"
],
"requests": 22,
"scriptMs": 51,
"requests": 21,
"scriptMs": 45,
"status": 200,
"tbt": 0,
"thirdParty": [],
@@ -322,30 +322,30 @@
"bytes": {
"css": 11177,
"font": 209501,
"html": 17081,
"html": 17027,
"image": 10684,
"js": 188341,
"js": 179297,
"other": 0
},
"cls": 0,
"fcp": 284,
"fcp": 276,
"inp": 40,
"interaction": "PL",
"lcp": 284,
"lcp": 276,
"lcpElement": {
"fetchpriority": "high",
"loading": "eager",
"src": "/_next/image?url=http%3A%2F%2Flocalhost%3A3370%2Fapi%2Fmedia%2Ffile%2Flibrary-2.webp&w=750&q=75",
"src": "/_next/image?url=http%3A%2F%2Flocalhost%3A3370%2Fapi%2Fmedia%2Ffile%2Flibrary-3.webp&w=750&q=75",
"tag": "img"
},
"load": 476,
"load": 444,
"prefetches": 8,
"profile": "desktop",
"renderBlocking": [
"/_next/static/css/b2d8ea1877879cf5.css"
],
"requests": 20,
"scriptMs": 47,
"requests": 19,
"scriptMs": 28,
"status": 200,
"tbt": 0,
"thirdParty": [],
@@ -357,30 +357,30 @@
"bytes": {
"css": 11177,
"font": 209501,
"html": 16640,
"html": 16588,
"image": 4815,
"js": 188341,
"js": 179297,
"other": 0
},
"cls": 0,
"fcp": 284,
"fcp": 272,
"inp": 40,
"interaction": "PL",
"lcp": 284,
"lcp": 272,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 469,
"load": 456,
"prefetches": 11,
"profile": "desktop",
"renderBlocking": [
"/_next/static/css/b2d8ea1877879cf5.css"
],
"requests": 19,
"scriptMs": 51,
"requests": 18,
"scriptMs": 43,
"status": 200,
"tbt": 0,
"thirdParty": [],
@@ -392,9 +392,9 @@
"bytes": {
"css": 11177,
"font": 209501,
"html": 17135,
"html": 17071,
"image": 4815,
"js": 188341,
"js": 179297,
"other": 0
},
"cls": 0,
@@ -408,14 +408,14 @@
"src": null,
"tag": "p"
},
"load": 472,
"load": 441,
"prefetches": 8,
"profile": "desktop",
"renderBlocking": [
"/_next/static/css/b2d8ea1877879cf5.css"
],
"requests": 19,
"scriptMs": 46,
"requests": 18,
"scriptMs": 30,
"status": 200,
"tbt": 0,
"thirdParty": [],
@@ -427,30 +427,30 @@
"bytes": {
"css": 11177,
"font": 209501,
"html": 16540,
"html": 16486,
"image": 9286,
"js": 188341,
"js": 179297,
"other": 0
},
"cls": 0,
"fcp": 292,
"fcp": 288,
"inp": 40,
"interaction": "PL",
"lcp": 292,
"lcp": 288,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "h1"
},
"load": 471,
"load": 453,
"prefetches": 8,
"profile": "desktop",
"renderBlocking": [
"/_next/static/css/b2d8ea1877879cf5.css"
],
"requests": 20,
"scriptMs": 40,
"requests": 19,
"scriptMs": 31,
"status": 200,
"tbt": 0,
"thirdParty": [],
@@ -462,30 +462,30 @@
"bytes": {
"css": 11177,
"font": 209501,
"html": 16793,
"html": 16753,
"image": 0,
"js": 188341,
"js": 187749,
"other": 0
},
"cls": 0,
"fcp": 280,
"fcp": 284,
"inp": 40,
"interaction": "PL",
"lcp": 280,
"lcp": 284,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 439,
"load": 438,
"prefetches": 8,
"profile": "desktop",
"renderBlocking": [
"/_next/static/css/b2d8ea1877879cf5.css"
],
"requests": 16,
"scriptMs": 51,
"scriptMs": 47,
"status": 200,
"tbt": 0,
"thirdParty": [],
@@ -497,30 +497,30 @@
"bytes": {
"css": 11177,
"font": 209501,
"html": 37303,
"html": 37304,
"image": 5267,
"js": 216587,
"js": 218795,
"other": 0
},
"cls": 0,
"fcp": 304,
"fcp": 288,
"inp": 40,
"interaction": "PL",
"lcp": 304,
"lcp": 288,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 493,
"load": 452,
"prefetches": 8,
"profile": "desktop",
"renderBlocking": [
"/_next/static/css/b2d8ea1877879cf5.css"
],
"requests": 22,
"scriptMs": 60,
"requests": 23,
"scriptMs": 52,
"status": 200,
"tbt": 0,
"thirdParty": [
@@ -534,28 +534,28 @@
"bytes": {
"css": 11177,
"font": 209501,
"html": 7711,
"html": 7677,
"image": 0,
"js": 188341,
"other": 2472
"js": 179297,
"other": 2450
},
"cls": 0,
"fcp": 428,
"inp": 40,
"fcp": 404,
"inp": 32,
"interaction": "PL",
"lcp": 480,
"lcp": 464,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "h1"
},
"load": 412,
"load": 523,
"prefetches": 14,
"profile": "desktop",
"renderBlocking": [],
"requests": 17,
"scriptMs": 44,
"requests": 16,
"scriptMs": 47,
"status": 404,
"tbt": 0,
"thirdParty": [],
@@ -568,91 +568,91 @@
"bytes": {
"css": 98168,
"font": 0,
"html": 24047,
"html": 24043,
"image": 0,
"js": 843378,
"js": 843368,
"other": 1690
},
"cls": 0,
"fcp": 1040,
"fcp": 1016,
"inp": null,
"interaction": null,
"lcp": 1040,
"lcp": 1016,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "a"
},
"load": 962,
"load": 944,
"prefetches": 0,
"profile": "desktop",
"renderBlocking": [
"/_next/static/css/de3d54fcc6ee5dc6.css",
"/_next/static/css/dc48c3ee3f159f65.css",
"/_next/static/css/c1e0b959dd828ab8.css",
"/_next/static/css/e5d1b6185968e333.css",
"/_next/static/css/4858144d3215dfc6.css",
"/_next/static/css/dc48c3ee3f159f65.css"
"/_next/static/css/4858144d3215dfc6.css"
],
"requests": 20,
"scriptMs": 351,
"scriptMs": 348,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 89,
"ttfb": 87,
"url": "/admin/login",
"runs": 3
}
},
"date": "2026-12-01T14:09:30.949Z",
"date": "2026-12-01T14:38:54.097Z",
"label": "webpack-1180-after",
"method": "scripts/perf-measure.mjs + reference/e2e/perf-lab.mjs",
"runs": 3,
"server": {
"coldStartHealthMs": 1197,
"coldStartFirstPageMs": 1221,
"firstPageMs": 22,
"coldStartHealthMs": 984,
"coldStartFirstPageMs": 1003,
"firstPageMs": 18,
"ttfb_home": {
"median": 3.5,
"p95": 6.8
"median": 3.6,
"p95": 5.6
},
"ttfb_md": {
"median": 30.7,
"p95": 37.1
"median": 21.7,
"p95": 27.5
},
"ttfb_sitemap": {
"median": 1.8,
"p95": 2.4
"median": 1.1,
"p95": 1.4
},
"ttfb_llms": {
"median": 44.6,
"p95": 56.7
"median": 34.1,
"p95": 42
},
"render": {
"home": {
"medianMs": 68.1,
"medianMs": 52.1,
"queries": 24,
"queryMs": 0,
"byCollection": {
"globals": 27,
"pages": 33,
"media": 9,
"pages": 33,
"forms": 3
}
},
"page": {
"medianMs": 53.1,
"medianMs": 32.2,
"queries": 21,
"queryMs": 1,
"queryMs": 0,
"byCollection": {
"globals": 27,
"media": 6,
"pages": 27,
"media": 6,
"forms": 3
}
},
"archive": {
"medianMs": 62,
"medianMs": 41.5,
"queries": 23,
"queryMs": 0,
"byCollection": {
@@ -664,19 +664,19 @@
}
},
"post": {
"medianMs": 65.3,
"medianMs": 27.5,
"queries": 26,
"queryMs": 0,
"byCollection": {
"globals": 27,
"media": 9,
"pages": 24,
"media": 9,
"posts": 15,
"forms": 3
}
},
"caseStudy": {
"medianMs": 50.2,
"medianMs": 29.9,
"queries": 22,
"queryMs": 0,
"byCollection": {
@@ -688,7 +688,7 @@
}
},
"form": {
"medianMs": 31.4,
"medianMs": 21.5,
"queries": 19,
"queryMs": 0,
"byCollection": {
@@ -699,19 +699,19 @@
}
},
"showcase": {
"medianMs": 48.8,
"medianMs": 50,
"queries": 27,
"queryMs": 0,
"byCollection": {
"globals": 24,
"pages": 33,
"media": 12,
"pages": 33,
"forms": 6,
"posts": 6
}
},
"notFound": {
"medianMs": 21.3,
"medianMs": 26.6,
"queries": 20,
"queryMs": 0,
"byCollection": {
@@ -721,7 +721,7 @@
}
},
"md": {
"medianMs": 29,
"medianMs": 37,
"queries": 16,
"queryMs": 0,
"byCollection": {
@@ -738,7 +738,7 @@
"byCollection": {}
},
"llms": {
"medianMs": 42,
"medianMs": 43,
"queries": 22,
"queryMs": 0,
"byCollection": {
@@ -750,7 +750,7 @@
}
},
"llmsFull": {
"medianMs": 55,
"medianMs": 56,
"queries": 38,
"queryMs": 0,
"byCollection": {
@@ -763,6 +763,6 @@
}
}
},
"rssMiB": 305
"rssMiB": 410
}
}
+1
View File
@@ -158,6 +158,7 @@ Turn off: `iapl({ doctor: false })`. Adapt: `iapl({ doctor: { tokenVar: 'MY_TOKE
| | `growth-submissions` | info / warning | (deep) form submissions kept without a retention; a warning when the oldest is over `growth.submissionDays` (730) |
| | `growth-kv` | warning | (deep) at most `growth.expiredKv` (1000) expired entries in `payload-kv` |
| | `growth-media` | info / warning | (deep) media no document or global points at; a warning over `growth.orphanedMedia` (25). From the first 5000 documents |
| | `growth-versions-config` | info | a collection or global in `src/collections` / `src/globals` turns versions on without `maxPerDoc` / `max` (Payload keeps 100) — the hint names the limit to add |
| | `growth-disk` | info | `.next/cache/images` over `growth.imageCacheMB` (1024), the local `media/` over `growth.uploadsMB` (2048), on the machine the doctor runs on |
| audit | `i18n-literals` | error / warning | from `iapl-audit`: hardcoded text in blocks (error) and components (warning), Polish literals in code (not the panel's `adminText()` / `{ en, pl }` labels in a schema file — the `iapl-audit` skill) |
| | `audit:<title>` | as reported | every other `iapl-audit --quick` finding, one per file |
+7
View File
@@ -99,6 +99,13 @@ the action to the form and the language, resolves the redirect and gives the bro
form** — the Local API reads with `overrideAccess`, so the document has the Emails tab (company addresses);
a hand-written `<FormRenderer form={form}>` used to send them in the HTML. Underneath it is `BuilderForm` (client).
**The form's code loads only on pages that show a form (1.18.0).** `RenderForm` renders a lazy `BuilderForm`, and
`BuilderForm` / `Turnstile` from `@intecion/ipal-kit/client` are the lazy wrappers (same props): the server renders the
whole form, the browser fetches the code while it hydrates — every other page carries none of it (reference site: −8.8 KB gzip with webpack, −6.1 KB with
Turbopack). The eager component, in every page's bundle: `import { BuilderForm } from
'@intecion/ipal-kit/client/eager'` and `<RenderForm Form={BuilderForm} …>`. The Turnstile widget's height is kept free
before Cloudflare draws it: `turnstileReserveHeight` (default 73, `0` for an invisible widget).
### Field types in the panel
text, email, textarea, number, **date**, **time** (1.11.1), select, **radio**, checkbox, **Checkbox group**,
message, **Step** (+ country/state as text), and **File** when `forms.attachments` is on ("Files" below).
+15
View File
@@ -50,6 +50,21 @@ export const Media: CollectionConfig = {
}
```
**Metadata (1.18.0).** Every JPEG and PNG upload that passes the limits loses its metadata — camera, date, GPS
position, comments — without re-encoding: `stripImageMetadata` drops the JPEG APP1 (EXIF, XMP), APP13 (IPTC) and
comment segments and the PNG text, eXIf and tIME chunks; the pixels and the colour profile stay byte for byte. A photo
whose EXIF says "rotate" is turned once (sharp, JPEG quality 92) so it does not show sideways. Only new uploads; no
stored variants are added. Off: `buildOptimizeUploadHook({ stripMetadata: false })`. Building blocks:
`stripImageMetadata(buffer, mimeType)` → `{ buffer, changed, orientation }`, `exifOrientation(app1)`.
**Unused media in the panel (1.18.0, opt-in).** `iapl({ unusedMedia: true })` (or `{ collections: ['media'] }`) puts a
notice above the list of each upload collection: how many files no page, entry or setting uses — by id (relations,
uploads in rich text and blocks, drafts and every language) or by file name inside a text — with a link that opens
Payload's own list filtered to them. The editor checks them and deletes them there (bulk delete, with its confirmation
and access rules); nothing is deleted by itself. Editors and admins see it; on a site with more than 5000 documents it
shows only a hint to run `iapl-doctor --deep` (`growth-media`). After turning it on: `pnpm generate:importmap`
(`@intecion/ipal-kit/admin#UnusedMediaNotice`).
`buildOptimizeUploadHook` and `buildMediaPlaceholderHook` use the `sharp` passed to
`buildConfig({ sharp })` — the plugin does not import it. Postgres with migrations: new fields →
`pnpm payload migrate:create`.
+22 -16
View File
@@ -20,12 +20,15 @@ response on that profile (the 404 page is the exception, below).
| LCP image | `<Media priority>`: `fetchpriority="high"`, `loading="eager"` and a preload; everything else lazy with `sizes` | `priority` / `eager` / `sizes` per image (`MEDIA_SIZES`) |
| Image formats | `buildImagesConfig()`: AVIF and WebP, the width the screen needs, a 31-day cache, R2 allowed | `buildImagesConfig({ … })` ([media.md](./media.md)) |
| Upload limits | `buildOptimizeUploadHook()`: images over 1.5 MB or 2560 px wide are stopped; the editor may let the plugin shrink them (WebP, metadata dropped) | `maxImageBytes`, `maxImageWidth`, `quality` |
| Upload metadata | every JPEG and PNG that passes the limits loses its metadata (camera, date, GPS, comments) without re-encoding — pixels and colour profile byte for byte; an EXIF "rotate" is applied once (JPEG q92) | `buildOptimizeUploadHook({ stripMetadata: false })`; the building block `stripImageMetadata(buffer, mime)` |
| No layout shift from images | width and height always from the document; a blur placeholder and the dominant colour (`buildMediaPlaceholderHook`) | `placeholderColor` |
| Embeds | `<YouTubeEmbed>`: a picture and a button; the iframe only after a click, from youtube-nocookie.com | `poster` |
| Client JavaScript | small client leaves; since 1.18.0 a page ships only the client components it renders (the `/client` barrels are no longer one client boundary) and the lightbox viewer loads on the first open | — |
| Client JavaScript | small client leaves; a page ships only the client components it renders (the `/client` barrels are no longer one client boundary); the lightbox viewer loads on the first open; the form engine and the Turnstile widget load only on pages that show a form (`BuilderForm` / `Turnstile` from `/client` are lazy wrappers, the server renders the whole form) — 6–9 KB gzip less JavaScript on every other page of the reference site (webpack −8.8, Turbopack −6.1) | `@intecion/ipal-kit/client/eager` → `<RenderForm Form={BuilderForm}>` |
| Turnstile | its 73 px are kept free before Cloudflare draws the widget: the form does not jump | `turnstileReserveHeight={0}` (an invisible widget) |
| Third parties before consent | none besides Google's tag in Consent Mode `advanced` (all signals denied); Meta, LinkedIn, TikTok and Clarity wait for consent; Turnstile only on a form's last step | `analytics={{ consentMode: 'basic' }}` — no request to Google before consent; `analytics={{ defer: true }}` — the tag after the first interaction |
| Fonts | the reference layout uses `next/font` (self-hosted, `display: 'swap'`, fallback metrics against layout shift) | the project's own fonts |
| Motion | the token durations (`duration-fast`, `-base`, `-slow`) are 0 ms with `prefers-reduced-motion: reduce`; the cookie banner, its switches and the cookie button stop their transitions too | `motion-reduce:` classes |
| Fonts | the reference layout (and every new site from `iapl create`) uses `next/font` (self-hosted, `display: 'swap'`, fallback metrics against layout shift) and does not preload the heading font: the stylesheet and the hero get the first round trips (phone: first paint and LCP 36–52 ms sooner) | the project's own fonts; `preload: true` on the heading font |
| Motion | the token durations (`duration-fast`, `-base`, `-slow`) are 0 ms with `prefers-reduced-motion: reduce`; the cookie banner, its switches and the cookie button stop their transitions too; a background video (`<Media videoMode="background">`) is paused for those visitors; the card hover fades a shadow layer (`opacity`, compositor-only) instead of animating `box-shadow` | `motion-reduce:` classes; `<Media pauseForReducedMotion={false}>`; `CARD_INTERACTIVE_SHADOW_CLASS` (the 1.17 hover) |
| 404 | the lazy 404 (`createNotFoundPage({ load })`) keeps its content's height with `placeholder` — the reference site sets it (phone: CLS 0.319 → 0, LCP 2.5 → 1.9 s) | the placeholder's height follows your 404 content |
| Admin only | Payload's colour-scheme client hints only on `/admin`, so a public page is requested once | `withSecurityConfig(…, { adminClientHints: false })` |
## 2. What a project must do
@@ -43,16 +46,18 @@ Every row is something the plugin cannot decide for you. `iapl-doctor --only per
**Elements** ([web.dev/articles/cls](https://web.dev/articles/cls))
- Images through `Media` (dimensions, `sizes`, lazy below the fold, never lazy for the LCP image —
[web.dev/articles/lcp-lazy-loading](https://web.dev/articles/lcp-lazy-loading)).
- Content that arrives after the first paint reserves its space. The lazy 404 is the plugin's own case:
`createNotFoundPage(content, { load, placeholder: <div style={{ minHeight: '36rem' }} /> })` with the height of your
404 content keeps the footer still.
- Content that arrives after the first paint reserves its space. The lazy 404 is the plugin's own case: the
reference `not-found.tsx` passes `placeholder: <div aria-hidden style={{ minHeight: 'max(290px, calc(212px + 11.5vw))' }} />`
— its 404 content's height, measured from 360 to 1920 px wide. Measure yours the same way when the 404 content
changes (the footer must not move when it arrives).
- Maps, videos and widgets behind a click: a picture and a button ([web.dev/articles/third-party-facades](https://web.dev/articles/third-party-facades)).
**Fonts** ([web.dev/articles/font-best-practices](https://web.dev/articles/font-best-practices),
[nextjs.org/docs/app/getting-started/fonts](https://nextjs.org/docs/app/getting-started/fonts))
- `next/font` only, at most two families, variable fonts, `subsets: ['latin', 'latin-ext']` for Polish,
`display: 'swap'`. Every subset of every family is a preloaded file: two variable families with two subsets are
four files (the reference site: 209 KB). A third family or a second weight file is the first thing to cut.
four files (the reference site: 209 KB). The heading font gets `preload: false` (the starter's default): its files
still come, after the stylesheet and the hero. A third family or a second weight file is the first thing to cut.
**Animations** ([web.dev/articles/animations-guide](https://web.dev/articles/animations-guide),
[web.dev/articles/prefers-reduced-motion](https://web.dev/articles/prefers-reduced-motion))
@@ -145,24 +150,24 @@ Measured on the reference site after a full test run (MongoDB; average record wi
| What | Grows with | What the plugin does (1.18.0) | What the project decides |
|---|---|---|---|
| Consent log (`consent-records`) | one record per banner choice | deleted after `retentionDays` (default 1095 — three years, the proof-of-consent period); the purge runs at most once a day, after a new record | `consentLog: { retentionDays }` |
| Statistics (`stats-visits`, opt-in) | one record per visit | deleted after `retentionDays` (default 90), same purge | `stats: { retentionDays }` |
| Consent log (`consent-records`) | one record per banner choice | deleted after `retentionDays` (default 1095 — three years, the proof-of-consent period): on MongoDB by a TTL index (`iapl_ttl` on the hidden `iaplTtlFrom`, kept at the current retention at every start), also on a quiet site; everywhere also by the purge after a new record (at most once a day) | `consentLog: { retentionDays, ttlIndex: false }` |
| Statistics (`stats-visits`, opt-in) | one record per visit | deleted after `retentionDays` (default 90) since the visit's last page view: TTL index on MongoDB, the same purge | `stats: { retentionDays, ttlIndex: false }` |
| Form submissions | one per sent form (files are never stored: they go out by e-mail) | **kept** until deleted in the panel — unless `forms: { submissionRetentionDays }` is set (1.18.0), then deleted after that many days, once a day after a new submission | the retention: personal data, a client decision (AGENTS.md → Project decisions) |
| Versions and drafts | every save | the plugin turns versions on nowhere; Payload keeps 100 per document by default (`maxPerDoc`, `max` for globals) | a lower limit where you turn versions on: `versions: { maxPerDoc: 20 }`; never `0` (unlimited) |
| Versions and drafts | every save | the plugin turns versions on nowhere; when a project turns them on for one of the plugin's collections or globals (overrides) without a limit, it keeps 20 per document (Payload's default is 100) | your own limit wins (`max`, `maxPerDoc`); on your own collections `versions: { maxPerDoc: 20 }` (the doctor's `growth-versions-config` hint); never `0` |
| `payload-kv` | 2FA attempt counters (one per staff account), the mail service state (one per host), enrolment nonces | expired mail-service nonces are swept (at most once a day, when the next enrolment starts); counters and state are bounded by accounts and hosts | — |
| Cookie review (opt-in) | distinct cookie names | upserted by name; a cookie that disappears is marked `gone`, not deleted (the history of what the site set) | delete old `gone` rows in the panel when the client agrees |
| `payload-preferences`, `payload-locked-documents`, `payload-jobs` | panel users, open documents, queued jobs | Payload removes them with the user, on save, and on completion (`deleteJobOnComplete`); the plugin queues no jobs | — |
| Media | uploads | Payload deletes the files (and R2 objects) with the document; nothing deletes media nobody uses | review `growth-media` findings in the panel |
| Media | uploads | Payload deletes the files (and R2 objects) with the document; nothing deletes media by itself. `iapl({ unusedMedia: true })` shows above the Media list how many files no page, entry or setting uses (by id, or by file name inside a text) and links to Payload's list filtered to them; the editor checks and deletes them there | turn it on (then `pnpm generate:importmap`); the doctor's `growth-media` counts them either way |
| `.next/cache/images` | each image × width × format (AVIF + WebP) | kept 31 days per variant (`minimumCacheTTL`); Next caps nothing by size | no persistent volume on `.next` in Coolify: every deploy starts empty |
| ISR output | pages × languages | rewritten in place on each revalidation | — |
| Logs | — | the plugin writes no files; it logs to stdout (Coolify keeps the container's log) | Coolify's log retention |
**Postgres and SQLite:** the same purges (one `DELETE … WHERE created_at < …`); no TTL indexes; the doctor reports
counts but not sizes. A consent log without its migration records nothing and so never purges.
**Postgres and SQLite:** the same purges (one `DELETE … WHERE created_at < …`); no TTL index and no `iaplTtlFrom`
column (no migration); the doctor reports counts but not sizes. A consent log without its migration records nothing and so never purges.
**What a project schedules:** nothing for the plugin's own logs — the purges run inside the site. A site that gets
no new consent records (or submissions) for a long time keeps the old ones until the next one comes; the doctor's
`growth-retention` rule says so. Database backups are the hosting's job (Coolify → the MongoDB resource → Backups).
**What a project schedules:** nothing for the plugin's own logs — on MongoDB the TTL indexes delete by themselves,
elsewhere the purges run inside the site after a new record. A SQL site that gets no new consent records (or
submissions) for a long time keeps the old ones until the next one comes; the doctor's `growth-retention` rule says so. Database backups are the hosting's job (Coolify → the MongoDB resource → Backups).
**How to check:** `pnpm exec iapl-doctor --deep --only growth` (or `--url` with `IAPL_DOCTOR_TOKEN`): document
counts, sizes (MongoDB), the oldest record, versions per collection and global, expired KV entries, media no
@@ -181,6 +186,7 @@ document points at; and on the machine it runs on, the image cache and the local
| `growth-submissions` | deep | form submissions kept without a retention (info; a warning when the oldest is over `submissionDays`) |
| `growth-kv` | deep | more than `expiredKv` expired entries in `payload-kv` |
| `growth-media` | deep | media nothing points at (info; a warning over `orphanedMedia`). Counted from the first 5000 documents |
| `growth-versions-config` | static | a collection or global of the project turns versions on without `maxPerDoc` / `max` (info: Payload keeps 100) |
| `growth-disk` | static | `.next/cache/images` over `imageCacheMB`, the local `media/` folder over `uploadsMB` (info) |
None of these rules deletes anything; the plugin never deletes media or submissions by itself.
+2 -1
View File
@@ -43,6 +43,7 @@ iapl({
| Option (`StatsOptions`) | Default | Description |
|---|---|---|
| `retentionDays` | `90` | older visits (by `lastAt`) are deleted |
| `ttlIndex` | `true` | 1.18.0, MongoDB: a TTL index deletes visits whose last page view is older than `retentionDays`, also on a quiet site; `false` drops it at the next start. Postgres / SQLite: not used |
| `timeZone` | `'Europe/Warsaw'` | day boundary (`day` field, salt rotation, charts) |
| `dashboard` | `true` | `false` removes only `StatsWidget` from the dashboard — the view and the nav link stay |
| `collectionOverrides` | none | changes `stats-visits`: an object merges `access` / `admin` / `hooks` key by key (your keys win), a function `(collection) => collection` takes over (keep the slug). Its `access.read` also decides who sees the stats view and the dashboard chart |
@@ -124,7 +125,7 @@ A sequence of page views with gaps under 30 minutes, within one day. A server re
instances (each has its own salt) can split an ongoing visit in two — irrelevant for statistics. Do
**not** store the salt in the database to "fix" this: then yesterday's hashes could be reversed to IPs.
Visits older than `retentionDays` are deleted automatically — at most once a day per server process,
On MongoDB a TTL index deletes them by itself (`ttlIndex`, 1.18.0). Everywhere, visits older than `retentionDays` are also deleted — at most once a day per server process,
on a page view, with one `db.deleteMany` query **in the background** (the page view does not wait for
the cleanup; an error goes to the log and the cleanup is retried on the next page view). The salt
changes when `day` changes in the `timeZone` zone.
+5
View File
@@ -231,6 +231,11 @@ provider: change its `resetSignal` prop to get the same.
| `onToken` | `(token: string \| null) => void` | — | token once solved; `null` on expiry / error / theme change |
| `theme` | `'page' \| 'auto' \| 'light' \| 'dark'` | `'page'` | `'page'` = the site's theme (`data-theme`, ThemeScript), no theme → `'auto'` |
| `resetSignal` | `number` | `0` | change the value → the widget issues a new token (what `reset()` does for the provider's widget) |
| `reserveHeight` | `number` | `73` | 1.18.0: the widget's height kept free before Cloudflare draws it (the form below does not jump); `0` for an invisible widget. Through a form: `turnstileReserveHeight` on `RenderForm` / `BuilderForm`, `TurnstileWidget({ reserveHeight })` |
`<Turnstile>` from `@intecion/ipal-kit/client` is a lazy wrapper since 1.18.0 (same props): the widget's code loads
where a form shows it, not with every page; the provider in the layout loads it the same way. The eager component:
`@intecion/ipal-kit/client/eager`.
### Why Turnstile is NOT fully "drop in and forget" like CookieBanner
+5 -4
View File
@@ -20,10 +20,11 @@ import { measureMedian } from './perf-lab.mjs'
const runs = Number(process.env.PERF_RUNS ?? 1)
const budgets = perfBudgets({
// measured 1.18.0: JS 184–188 kB, CSS 11–12 kB, fonts 209.5 kB (Inter + Fraunces, latin + latin-ext — four
// preloaded files: see "fonts" in docs/performance.md), LCP 0.8 s on the phone, 0.3 s on the desktop
desktop: { cssBytes: 16_000, fontBytes: 215_000, jsBytes: 200_000, lcp: 800, renderBlocking: 1, requests: 36, tbt: 50 },
mobile: { cssBytes: 16_000, fontBytes: 215_000, jsBytes: 200_000, lcp: 1500, renderBlocking: 1, requests: 30, tbt: 100 },
// measured 1.18.0 (docs/dev/perf/*-1180-after.json): JS 175–180 kB on a page without a form, 184–188 kB with one
// (the form's code loads there only), CSS 11–12 kB, fonts 209.5 kB (Inter + Fraunces, latin + latin-ext; the
// heading font not preloaded), LCP 0.74–0.82 s on the phone, 0.28–0.30 s on the desktop
desktop: { cssBytes: 16_000, fontBytes: 215_000, jsBytes: 195_000, lcp: 800, renderBlocking: 1, requests: 36, tbt: 50 },
mobile: { cssBytes: 16_000, fontBytes: 215_000, jsBytes: 195_000, lcp: 1500, renderBlocking: 1, requests: 30, tbt: 100 },
})
/** One of each template (AGENTS.md → Site map), with what differs for that page. */
+1 -1
View File
@@ -22,8 +22,8 @@ export { CookieScanButton } from '../modules/consent/scanner/CookieScanButton.js
export { CookieSiteCheckTab } from '../modules/consent/scanner/CookieSiteCheckTab.js'
export { CookieCrawlAlert } from '../modules/consent/scanner/crawl/CookieCrawlAlert.js'
export { IntegrationAlerts } from '../modules/integrations/IntegrationAlerts.js'
export { UNUSED_MEDIA_LINK_LIMIT, UnusedMediaNotice } from '../modules/media/UnusedMediaNotice.js'
export { IntegrationStatusBanner } from '../modules/integrations/IntegrationStatusBanner.js'
export { UNUSED_MEDIA_LINK_LIMIT, UnusedMediaNotice } from '../modules/media/UnusedMediaNotice.js'
export { SafeTotpView } from '../modules/security/totp/SafeTotpView.js'
export type { SafeTotpViewProps } from '../modules/security/totp/SafeTotpView.js'
export { TotpRedirectProvider } from '../modules/security/totp/TotpRedirectProvider.js'
+3 -3
View File
@@ -41,9 +41,6 @@ export type { ConstructionNoticeClassNames } from '../modules/construction/Const
export { CONSTRUCTION_CLOSE_LABEL, CONSTRUCTION_CLOSE_LABEL_PL, constructionCloseLabel } from '../modules/construction/texts.js'
export type { ConstructionMode } from '../modules/construction/types.js'
export { formatFileSize } from '../modules/forms/attachments/fileTypes.js'
// `BuilderForm` is the lazy wrapper since 1.18.0 (same props, the server renders the whole form): the form's code
// loads only on a page that shows one. The eager component: `@intecion/ipal-kit/client/eager`.
export { LazyBuilderForm as BuilderForm } from '../modules/forms/LazyBuilderForm.js'
export type { BuilderFieldRenderArgs, BuilderFormClassNames, BuilderFormProps } from '../modules/forms/BuilderForm.js'
export { autoCompleteFor, fileFieldError, fileFieldRules, initialBuilderValues, inputFields, splitSteps, stepOfField, validateBuilderFields, visibleFields } from '../modules/forms/builderLogic.js'
export type { BuilderFile } from '../modules/forms/builderLogic.js'
@@ -60,6 +57,9 @@ export type {
export { formAnalyticsOnSuccess } from '../modules/forms/formAnalytics.js'
export type { FormAnalyticsConfig } from '../modules/forms/formAnalytics.js'
export { HONEYPOT_FIELD, honeypotInputProps, isHoneypotTripped } from '../modules/forms/honeypot.js'
// `BuilderForm` is the lazy wrapper since 1.18.0 (same props, the server renders the whole form): the form's code
// loads only on a page that shows one. The eager component: `@intecion/ipal-kit/client/eager`.
export { LazyBuilderForm as BuilderForm } from '../modules/forms/LazyBuilderForm.js'
export { useBuilderForm } from '../modules/forms/useBuilderForm.js'
export type { BuilderFormApi, UseBuilderFormOptions } from '../modules/forms/useBuilderForm.js'
export { useContactForm } from '../modules/forms/useContactForm.js'
+2 -2
View File
@@ -8,8 +8,8 @@
export { DOCTOR_USAGE, expandSites, parseDoctorArgs, runDoctorCli } from '../modules/doctor/cli.js'
export { formatDriftTable, formatReport } from '../modules/doctor/format.js'
// What grows (docs/performance.md → "What grows"): the deep collector, the rules and their thresholds
export { collectGrowth } from '../modules/doctor/growth.js'
export type { GrowthStatus } from '../modules/doctor/growth.js'
export { collectGrowth, findUnusedMedia } from '../modules/doctor/growth.js'
export type { GrowthStatus, UnusedMedia } from '../modules/doctor/growth.js'
export { bareHost, createDoctorContext, loadDoctorConfig, parseEnvFile, readAuditSkips } from '../modules/doctor/project.js'
export type { DoctorContext } from '../modules/doctor/project.js'
export { planSkills } from '../modules/doctor/rules/agents.js'
+5
View File
@@ -618,6 +618,10 @@ export { assertDevelopmentHosts, DEFAULT_DEVELOPMENT_HOSTS, isDevelopmentHost, m
export { clientIp, ipRateKey, releaseRateLimit, setIpv6Grouping, setRateLimitStore, setUnknownIpFactor, UNKNOWN_IP_FACTOR } from './modules/shared/rateLimit.js'
export type { Ipv6Grouping } from './modules/shared/rateLimit.js'
export type { ClientIpOptions, RateLimitStore } from './modules/shared/rateLimit.js'
// What grows (docs/performance.md §6): MongoDB TTL indexes of the plugin's logs, the version limit of its own entities
export { isMongo, syncTtlIndex, TTL_FIELD, TTL_INDEX, ttlField } from './modules/shared/ttl.js'
export type { TtlSyncResult } from './modules/shared/ttl.js'
export { PLUGIN_VERSION_LIMIT, withVersionLimit } from './modules/shared/versionLimit.js'
export { buildSlugField, toSlug } from './modules/slug/index.js'
export { STATS_SLUG } from './modules/stats/index.js'
export type { StatsOptions, StatsPage, StatsVisit } from './modules/stats/index.js'
@@ -633,6 +637,7 @@ export type { Theme, ThemeConfig, ThemeSetting } from './modules/theme/index.js'
export { defineTokens, IAPL_BREAKPOINTS, IAPL_TOKENS, iaplVar, IPAL_BREAKPOINTS, IPAL_TOKENS, ipalVar } from './modules/tokens/index.js'
export type { IaplTokenName, IpalTokenName, TokensInput } from './modules/tokens/index.js'
export { getTurnstileConfig, TURNSTILE_SECRET_ENV, turnstileSecretFromEnv } from './modules/turnstile/config.js'
export type { TurnstileConfig } from './modules/turnstile/config.js'
export { iapl, ipalKit } from './plugin.js'
export type { IaplOptions, IpalOptions, MailOptions, ThemeOptions } from './types.js'
+1 -1
View File
@@ -1,12 +1,12 @@
import type { CollectionConfig, Endpoint, PayloadRequest } from 'payload'
import { TTL_FIELD } from '../shared/ttl.js'
import type { CollectionOverride } from '../shared/collectionOverride.js'
import { userMeetsRole } from '../access/predicates.js'
import { createDailyPurge } from '../shared/purge.js'
import { clientIp, consumeRateLimit } from '../shared/rateLimit.js'
import { readCappedBody as readCapped } from '../shared/readCappedBody.js'
import { TTL_FIELD } from '../shared/ttl.js'
import { CONSENT_CATEGORIES } from './categories.js'
import { CONSENT_CATEGORY_LABELS } from './categoryLabels.js'
import { CONSENT_VERSION } from './storage.js'
+2 -2
View File
@@ -132,7 +132,7 @@ export async function findUnusedMedia(payload: BasePayload, { limit = ORPHAN_SCA
for (const u of uploads) {
const res = await payload.find({ collection: u.slug as never, depth: 0, limit, overrideAccess: true, pagination: false, select: { filename: true } as never })
for (const d of res.docs as Array<{ filename?: null | string; id: number | string }>) {
files.set(String(d.id), { filename: d.filename ?? null, id: d.id, slug: u.slug })
files.set(String(d.id), { id: d.id, slug: u.slug, filename: d.filename ?? null })
if (d.filename) {byName.set(d.filename.toLowerCase(), String(d.id))}
}
}
@@ -179,6 +179,6 @@ export async function findUnusedMedia(payload: BasePayload, { limit = ORPHAN_SCA
}
}
const byCollection: UnusedMedia['byCollection'] = Object.fromEntries(uploads.map((u) => [u.slug, []]))
for (const [key, f] of files) {if (!seen.has(key)) {byCollection[f.slug].push({ filename: f.filename, id: f.id })}}
for (const [key, f] of files) {if (!seen.has(key)) {byCollection[f.slug].push({ id: f.id, filename: f.filename })}}
return { byCollection, checked, complete, total: files.size }
}
+2 -2
View File
@@ -24,13 +24,13 @@ export type RenderFormProps = {
/** The project's `sendForm` server action (createSubmitAction). */
action: SendFormAction
classNames?: BuilderFormClassNames
/** Rich text styling for message blocks and the confirmation (same as RenderRichText). */
converters?: JSXConvertersFunction
/**
* The client form component. Default: the lazy one (1.18.0) — its code loads only on pages with a form, the HTML
* is complete either way. `Form={BuilderForm}` from `@intecion/ipal-kit/client/eager` = in every page's bundle.
*/
Form?: ComponentType<BuilderFormProps>
/** Rich text styling for message blocks and the confirmation (same as RenderRichText). */
converters?: JSXConvertersFunction
/** The `form` relationship of the block, populated (page query depth ≥ 1). An id or null renders nothing. */
form: BuilderFormDoc | null | number | string | undefined
/**
+3 -3
View File
@@ -51,13 +51,13 @@ export async function syncTtlIndex(
return 'dropped'
}
// records from before 1.18.0 (or written by another path): the TTL counts from their own date
await coll.updateMany({ [TTL_FIELD]: { $exists: false }, [from]: { $type: 'date' } }, [{ $set: { [TTL_FIELD]: `$${from}` } }])
await coll.updateMany({ [from]: { $type: 'date' }, [TTL_FIELD]: { $exists: false } }, [{ $set: { [TTL_FIELD]: `$${from}` } }])
const seconds = Math.round(days * 86_400)
if (!existing) {
await coll.createIndex({ [TTL_FIELD]: 1 }, { expireAfterSeconds: seconds, name: TTL_INDEX })
await coll.createIndex({ [TTL_FIELD]: 1 }, { name: TTL_INDEX, expireAfterSeconds: seconds })
return 'created'
}
if (existing.expireAfterSeconds === seconds) {return 'none'}
await db.connection!.db!.command({ collMod: coll.collectionName, index: { expireAfterSeconds: seconds, name: TTL_INDEX } })
await db.connection!.db!.command({ collMod: coll.collectionName, index: { name: TTL_INDEX, expireAfterSeconds: seconds } })
return 'updated'
}
+1 -1
View File
@@ -14,6 +14,6 @@ export function withVersionLimit<T extends Versioned>(entity: T, kind: 'collecti
if (!v) {return entity}
const key = kind === 'global' ? 'max' : 'maxPerDoc'
if (v === true) {return { ...entity, versions: { [key]: limit } }}
if (typeof v === 'object' && typeof (v as Record<string, unknown>)[key] !== 'number') {return { ...entity, versions: { ...(v as object), [key]: limit } }}
if (typeof v === 'object' && typeof (v as Record<string, unknown>)[key] !== 'number') {return { ...entity, versions: { ...(v), [key]: limit } }}
return entity
}
+3 -3
View File
@@ -1,6 +1,5 @@
import type { Endpoint, PayloadRequest } from 'payload'
import { TTL_FIELD } from '../shared/ttl.js'
import type { StatsOptions, StatsPage, StatsVisit } from './collection.js'
import { gpcFromHeaders, resolveConsent } from '../consent/gpc.js'
@@ -8,6 +7,7 @@ import { CONSENT_COOKIE, CONSENT_VERSION, readConsentRecord } from '../consent/s
import { createDailyPurge } from '../shared/purge.js'
import { clientIp, consumeRateLimit } from '../shared/rateLimit.js'
import { readCappedBody } from '../shared/readCappedBody.js'
import { TTL_FIELD } from '../shared/ttl.js'
import { STATS_SLUG } from './collection.js'
import { dayOf, deviceFromUa, isBot, referrerHost, sanitizePath, VISITOR_ID_PATTERN } from './parse.js'
import { visitKey } from './visitKey.js'
@@ -120,9 +120,9 @@ export function buildStatsEndpoint({ retentionDays = 90, timeZone = 'Europe/Wars
data: {
exit: path,
lastAt: now.toISOString(),
[TTL_FIELD]: now.toISOString(), // MongoDB TTL (shared/ttl.ts)
pageCount: pages.length,
pages,
[TTL_FIELD]: now.toISOString(), // MongoDB TTL (shared/ttl.ts)
...(visitorId && !visit.visitorId ? { visitorId } : {}),
} as never,
depth: 0,
@@ -138,11 +138,11 @@ export function buildStatsEndpoint({ retentionDays = 90, timeZone = 'Europe/Wars
entry: path,
exit: path,
lastAt: now.toISOString(),
[TTL_FIELD]: now.toISOString(), // MongoDB TTL (shared/ttl.ts)
pageCount: 1,
pages: [{ p: path, t: now.toISOString() }],
referrer: referrerHost(body.r, host),
startedAt: now.toISOString(),
[TTL_FIELD]: now.toISOString(), // MongoDB TTL (shared/ttl.ts)
visitKey: key,
...(typeof body.l === 'string' && /^[a-z]{2}(?:-[A-Za-z]{2})?$/.test(body.l) ? { locale: body.l } : {}),
...(country && /^[A-Z]{2}$/.test(country) && country !== 'XX' ? { country } : {}),
+2 -2
View File
@@ -1,8 +1,8 @@
'use client'
import { TURNSTILE_HEIGHT } from './turnstileHeight.js'
import { useEffect, useRef } from 'react'
import { useTheme } from '../theme/useTheme.js'
import { TURNSTILE_HEIGHT } from './turnstileHeight.js'
declare global {
interface Window {
@@ -66,7 +66,7 @@ export type TurnstileTheme = 'auto' | 'dark' | 'light' | 'page'
* The script is injected directly (no next/script dependency) so the widget
* stays framework-agnostic.
*/
export function Turnstile({ onToken, resetSignal = 0, siteKey, theme = 'page', reserveHeight = TURNSTILE_HEIGHT }: TurnstileProps) {
export function Turnstile({ onToken, reserveHeight = TURNSTILE_HEIGHT, resetSignal = 0, siteKey, theme = 'page' }: TurnstileProps) {
const ref = useRef<HTMLDivElement>(null)
const widgetId = useRef<null | string>(null)
const pageTheme = useTheme().theme
+3 -3
View File
@@ -77,9 +77,9 @@ import { migrateTitleSeparator } from './modules/seo/titleSeparator.js'
import { applyCollectionOverride } from './modules/shared/collectionOverride.js'
import { assertDevelopmentHosts } from './modules/shared/developmentHosts.js'
import { withRetention } from './modules/shared/retention.js'
import { assertPluginSwitches } from './modules/shared/switches.js'
import { isMongo, syncTtlIndex, ttlField } from './modules/shared/ttl.js'
import { withVersionLimit } from './modules/shared/versionLimit.js'
import { assertPluginSwitches } from './modules/shared/switches.js'
import { buildStatsCollection, buildStatsEndpoint } from './modules/stats/index.js'
import { visitorCookieFor } from './modules/stats/visitorCookie.js'
@@ -884,7 +884,7 @@ export const iapl = (options: IaplOptions): Plugin => {
// MongoDB: the hidden date the TTL index counts from (shared/ttl.ts); SQL keeps its schema as it was
if (isMongo(config)) {consentCollection.fields = [...consentCollection.fields, ttlField()]}
config.collections = [...(config.collections ?? []), applyCollectionOverride(consentCollection, logOptions.collectionOverrides)]
ttlSyncs.push({ days: logOptions.retentionDays ?? 1095, enabled: logOptions.ttlIndex !== false, from: 'createdAt', slug: CONSENT_LOG_SLUG })
ttlSyncs.push({ slug: CONSENT_LOG_SLUG, days: logOptions.retentionDays ?? 1095, enabled: logOptions.ttlIndex !== false, from: 'createdAt' })
config.endpoints = [...(config.endpoints ?? []), buildConsentLogEndpoint(logOptions)]
config = withRetention(config, 'consent-records', logOptions.retentionDays ?? 1095)
}
@@ -969,7 +969,7 @@ export const iapl = (options: IaplOptions): Plugin => {
const statsCollection = buildStatsCollection()
if (isMongo(config)) {statsCollection.fields = [...statsCollection.fields, ttlField()]}
config.collections = [...(config.collections ?? []), applyCollectionOverride(statsCollection, statsOptions.collectionOverrides)]
ttlSyncs.push({ days: statsOptions.retentionDays ?? 90, enabled: statsOptions.ttlIndex !== false, from: 'lastAt', slug: 'stats-visits' })
ttlSyncs.push({ slug: 'stats-visits', days: statsOptions.retentionDays ?? 90, enabled: statsOptions.ttlIndex !== false, from: 'lastAt' })
config.endpoints = [...(config.endpoints ?? []), buildStatsEndpoint(statsOptions)]
config = withRetention(config, 'stats-visits', statsOptions.retentionDays ?? 90)
config.admin = {
+10 -10
View File
@@ -154,14 +154,6 @@ export type IaplOptions = {
* factor: whoever the dashboard is drawn for sees the full text.
*/
dashboardAlerts?: { cookies?: 'all' | 'editor'; integrations?: 'admin' | 'all' | 'editor' }
/**
* Unused media in the panel (1.18.0; docs/media.md): above the list of every upload collection (or the ones
* named), how many files no page, entry or setting uses, with a link to Payload's list filtered to them — the
* editor checks and deletes them by hand (nothing is deleted by itself). Off by default: it adds an entry to the
* admin import map (`pnpm generate:importmap`). `true` or `{ collections: ['media'] }`.
*/
unusedMedia?: boolean | { collections?: string[] }
/**
* Host patterns of the project's development, preview and staging addresses (`*` = any characters).
* Default: `DEFAULT_DEVELOPMENT_HOSTS` — `['*.dev.netscale.pl']`, Intecion's own development domain,
@@ -191,6 +183,7 @@ export type IaplOptions = {
* onInit work or admin components.
*/
enabled?: boolean
/**
* Text written in one language fills the same field in every language that is
* still empty; a language with its own text is never overwritten. Default on
@@ -200,7 +193,6 @@ export type IaplOptions = {
* Building blocks: buildFillEmptyLocalesGlobalHook / …CollectionHook.
*/
fillEmptyLocales?: { 'cookie-review'?: string[]; 'cookie-settings'?: string[] } | boolean
forms?: FormsOption
/**
@@ -283,6 +275,7 @@ export type IaplOptions = {
* over `seo.searchSettings`.
*/
searchSettings?: ((defaults: Field[]) => Field[]) | false
/**
* SEO — adds meta fields to chosen collections (via @payloadcms/plugin-seo)
* and enables locale-aware metadata helpers.
@@ -304,7 +297,6 @@ export type IaplOptions = {
* follows the new server. docs/security.md "Stored secrets".
*/
secrets?: { reenterOnChange?: false; writeOnly?: false }
seo?: SeoOption
/** Additional fields injected into SiteSettings global */
@@ -477,6 +469,14 @@ export type IaplOptions = {
}
| false
/**
* Unused media in the panel (1.18.0; docs/media.md): above the list of every upload collection (or the ones
* named), how many files no page, entry or setting uses, with a link to Payload's list filtered to them — the
* editor checks and deletes them by hand (nothing is deleted by itself). Off by default: it adds an entry to the
* admin import map (`pnpm generate:importmap`). `true` or `{ collections: ['media'] }`.
*/
unusedMedia?: { collections?: string[] } | boolean
/**
* White-label the admin panel: show the CLIENT's brand (logo + name) in the
* admin — login screen and nav — pulled from SiteSettings, set by the editor
+4 -2
View File
@@ -1,7 +1,7 @@
import type { ReactElement, ReactNode } from 'react'
import { Children, cloneElement, createElement as h, isValidElement } from 'react'
import { renderToStaticMarkup } from 'react-dom/server'
import { prerender } from 'react-dom/static'
import { describe, expect, test, vi } from 'vitest'
import type { BlockContent, BlockRegistryOptions } from '../src/exports/blocks-rsc.js'
@@ -34,7 +34,9 @@ async function expand(node: ReactNode): Promise<ReactNode> {
return cloneElement(el, undefined, ...kids)
}
const render = async (node: ReactNode) => renderToStaticMarkup(h('div', null, (await expand(node)) as ReactNode))
// prerender waits for every lazy part, like Next's server render: the form's code is lazy since 1.18.0
const render = async (node: ReactNode) =>
(await new Response((await prerender(h('div', null, (await expand(node)) as ReactNode))).prelude).text()).replace(/<!--(?: |\$\??|\/\$)-->/g, '') // hydration markers out: the markup as before
const image = (alt = 'Photo') => ({ id: 1, alt, filename: 'a.jpg', height: 600, mimeType: 'image/jpeg', url: '/media/a.jpg', width: 900 })
const link = (label: string) => ({ type: 'internal' as const, appearance: 'primary', label, page: { id: 2, slug: 'kontakt' } })
+4 -4
View File
@@ -1,5 +1,6 @@
import { createElement, isValidElement } from 'react'
import { renderToStaticMarkup } from 'react-dom/server'
import { prerender } from 'react-dom/static'
import { describe, expect, test, vi } from 'vitest'
import type { BuilderField, BuilderFormDoc } from '../src/modules/forms/builderTypes.js'
@@ -160,11 +161,10 @@ describe('page values (values prop) and prepareBuilderForm', () => {
expect(html).not.toContain('unknown')
})
test('RenderForm passes values through', () => {
test('RenderForm passes values through (the lazy form renders in full on the server)', async () => {
const action = async () => ({ message: 'ok', success: true })
const html = renderToStaticMarkup(
createElement(RenderForm, { action, form: withSubject, locale: 'pl', texts, values: { subject: 'Broszki' } }),
)
const { prelude } = await prerender(createElement(RenderForm, { action, form: withSubject, locale: 'pl', texts, values: { subject: 'Broszki' } }))
const html = await new Response(prelude).text()
expect(html).toContain('Broszki')
})
+2 -2
View File
@@ -420,8 +420,8 @@ describe('consent log: on by default, fails soft without its table', () => {
const lines = logger.error.mock.calls.map((c) => String(c[0])).filter((m) => m.includes('consent-records table does not exist'))
expect(lines.length).toBeLessThanOrEqual(1)
expect(payload.create).toHaveBeenCalledTimes(2)
// the body's gpc never reaches the record (the shape is unchanged)
expect(Object.keys((payload.create.mock.calls[0] as unknown as [{ data: object }])[0].data).sort()).toEqual(['choices', 'consentId', 'version'])
// the body's gpc never reaches the record; iaplTtlFrom is the date a MongoDB TTL index counts from (1.18.0)
expect(Object.keys((payload.create.mock.calls[0] as unknown as [{ data: object }])[0].data).sort()).toEqual(['choices', 'consentId', 'iaplTtlFrom', 'version'])
})
describe('limits: body size and version', () => {
+11 -11
View File
@@ -91,7 +91,7 @@ describe('TTL indexes (item 10)', () => {
return {}
},
}
const payload = { db: { collections: { 'consent-records': { collection: coll } }, connection: { db: { command: async (c: object) => void calls.push(`collMod ${JSON.stringify(c)}`) } }, name: 'mongoose' } }
const payload = { db: { name: 'mongoose', collections: { 'consent-records': { collection: coll } }, connection: { db: { command: async (c: object) => void calls.push(`collMod ${JSON.stringify(c)}`) } } } }
return { calls, payload: payload as never }
}
@@ -99,18 +99,18 @@ describe('TTL indexes (item 10)', () => {
const { calls, payload } = fake([{ name: '_id_' }, { name: 'createdAt_1' }])
expect(await syncTtlIndex(payload, 'consent-records', { days: 1095, enabled: true, from: 'createdAt' })).toBe('created')
expect(calls).toEqual([
`backfill {"${TTL_FIELD}":{"$exists":false},"createdAt":{"$type":"date"}} [{"$set":{"${TTL_FIELD}":"$createdAt"}}]`,
`backfill {"createdAt":{"$type":"date"},"${TTL_FIELD}":{"$exists":false}} [{"$set":{"${TTL_FIELD}":"$createdAt"}}]`,
`create {"${TTL_FIELD}":1} ${1095 * 86_400}`,
])
})
test('a changed retention moves the index (collMod); the same one does nothing; off drops it', async () => {
const changed = fake([{ expireAfterSeconds: 90 * 86_400, name: TTL_INDEX }])
const changed = fake([{ name: TTL_INDEX, expireAfterSeconds: 90 * 86_400 }])
expect(await syncTtlIndex(changed.payload, 'consent-records', { days: 30, enabled: true, from: 'lastAt' })).toBe('updated')
expect(changed.calls.at(-1)).toBe(`collMod {"collMod":"consent-records","index":{"expireAfterSeconds":${30 * 86_400},"name":"${TTL_INDEX}"}}`)
const same = fake([{ expireAfterSeconds: 30 * 86_400, name: TTL_INDEX }])
expect(changed.calls.at(-1)).toBe(`collMod {"collMod":"consent-records","index":{"name":"${TTL_INDEX}","expireAfterSeconds":${30 * 86_400}}}`)
const same = fake([{ name: TTL_INDEX, expireAfterSeconds: 30 * 86_400 }])
expect(await syncTtlIndex(same.payload, 'consent-records', { days: 30, enabled: true, from: 'lastAt' })).toBe('none')
const off = fake([{ expireAfterSeconds: 30 * 86_400, name: TTL_INDEX }])
const off = fake([{ name: TTL_INDEX, expireAfterSeconds: 30 * 86_400 }])
expect(await syncTtlIndex(off.payload, 'consent-records', { days: 30, enabled: false, from: 'lastAt' })).toBe('dropped')
expect(off.calls).toEqual([`drop ${TTL_INDEX}`])
})
@@ -127,7 +127,7 @@ describe('versions (item 13)', () => {
expect(withVersionLimit({ slug: 'site-integrations', versions: true }, 'global').versions).toEqual({ max: 20 })
expect(withVersionLimit({ slug: 'forms', versions: { drafts: true } }, 'collection').versions).toEqual({ drafts: true, maxPerDoc: 20 })
expect(withVersionLimit({ slug: 'forms', versions: { maxPerDoc: 0 } }, 'collection').versions).toEqual({ maxPerDoc: 0 }) // the project's own (unlimited) wins
expect(withVersionLimit({ slug: 'forms' }, 'collection').versions).toBeUndefined()
expect(withVersionLimit({ slug: 'forms' } as { slug: string; versions?: unknown }, 'collection').versions).toBeUndefined()
})
test('doctor hint for a project that turns versions on without a limit', async () => {
@@ -160,10 +160,10 @@ describe('unused media in the panel (item 12)', () => {
find: async ({ collection }: { collection: string }) => ({ docs: docs[collection] ?? [] }),
findGlobal: async () => ({}),
})
const editor = { collection: 'users', id: 1, roles: ['editor'] }
const editor = { id: 1, collection: 'users', roles: ['editor'] }
test('a link to Payload\'s own list filtered to the unused files — nothing is deleted', async () => {
const p = payload({ media: [{ filename: 'a.jpg', id: 'm1' }, { filename: 'plan.pdf', id: 'm2' }, { filename: 'b.jpg', id: 'm3' }], pages: [{ hero: 'm1', text: 'see /api/media/file/plan.pdf' }] })
const p = payload({ media: [{ id: 'm1', filename: 'a.jpg' }, { id: 'm2', filename: 'plan.pdf' }, { id: 'm3', filename: 'b.jpg' }], pages: [{ hero: 'm1', text: 'see /api/media/file/plan.pdf' }] })
const html = renderToStaticMarkup(await UnusedMediaNotice({ adminRoute: '/admin', collection: 'media', i18n: { language: 'en' }, payload: p as never, user: editor }))
expect(html).toContain('1 file is not used on any page, entry or setting.')
expect(html).toContain('href="/admin/collections/media?where[id][in][0]=m3"')
@@ -171,10 +171,10 @@ describe('unused media in the panel (item 12)', () => {
})
test('nothing for a visitor account or when every file is used; only a hint when the site is too big to check here', async () => {
const used = payload({ media: [{ filename: 'a.jpg', id: 'm1' }], pages: [{ hero: 'm1' }] })
const used = payload({ media: [{ id: 'm1', filename: 'a.jpg' }], pages: [{ hero: 'm1' }] })
expect(await UnusedMediaNotice({ collection: 'media', payload: used as never, user: editor })).toBeNull()
expect(await UnusedMediaNotice({ collection: 'media', payload: used as never, user: null })).toBeNull()
const broken = { ...used, find: async ({ collection }: { collection: string }) => { if (collection === 'pages') {throw new Error('no')} return { docs: [{ filename: 'a.jpg', id: 'm1' }] } } }
const broken = { ...used, find: async ({ collection }: { collection: string }) => { if (collection === 'pages') {throw new Error('no')} return { docs: [{ id: 'm1', filename: 'a.jpg' }] } } }
expect(renderToStaticMarkup(await UnusedMediaNotice({ collection: 'media', payload: broken as never, user: editor }))).toContain('too many documents to check')
})
})
+1 -1
View File
@@ -70,7 +70,7 @@ describe('stripImageMetadata', () => {
describe('buildOptimizeUploadHook: metadata on uploads that pass the limits', () => {
const run = async (data: Buffer, options = {}) => {
const file = { data, mimetype: 'image/jpeg', name: 'photo.jpg', size: data.length }
const file = { name: 'photo.jpg', data, mimetype: 'image/jpeg', size: data.length }
await buildOptimizeUploadHook(options)({ args: { data: {} }, operation: 'create', req: { file, i18n: { language: 'en' }, payload: { config: { sharp } } } } as never)
return file
}