@tdacorp/hyle-sdk 0.14.1 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -8
- package/dist/check-routes-bin.js +10 -8
- package/dist/{chunk-4V4VKB3O.js → chunk-DMK4XQLU.js} +470 -385
- package/dist/{chunk-R5EMI4HQ.js → chunk-PJMJMP66.js} +3 -1
- package/dist/comments.cjs +6 -4
- package/dist/comments.js +6 -5
- package/dist/{diagram-viewer-DYX6R63Y.js → diagram-viewer-FJPED4SN.js} +46 -26
- package/dist/{embed-B76zRRPa.d.cts → embed-BmdwA2G9.d.cts} +9 -4
- package/dist/{embed-SqOBGI-E.d.ts → embed-DNTZ2UXv.d.ts} +9 -4
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/labels-nmukKYgL.d.cts +37 -0
- package/dist/labels-nmukKYgL.d.ts +37 -0
- package/dist/mermaid-diagram.cjs +59 -30
- package/dist/mermaid-diagram.d.cts +4 -37
- package/dist/mermaid-diagram.d.ts +4 -37
- package/dist/mermaid-diagram.js +7 -5
- package/dist/mermaid-image.cjs +1382 -0
- package/dist/mermaid-image.d.cts +29 -0
- package/dist/mermaid-image.d.ts +29 -0
- package/dist/mermaid-image.js +94 -0
- package/dist/next.cjs +1330 -1118
- package/dist/next.d.cts +61 -11
- package/dist/next.d.ts +61 -11
- package/dist/next.js +922 -793
- package/dist/react.cjs +267 -184
- package/dist/react.d.cts +29 -6
- package/dist/react.d.ts +29 -6
- package/dist/react.js +1 -1
- package/dist/{resolve-DC2ccfwA.d.ts → resolve-Ae7UFjsQ.d.ts} +1 -1
- package/dist/{resolve-DKLVftk_.d.cts → resolve-euZ4-aC9.d.cts} +1 -1
- package/dist/styles.css +11 -22
- package/dist/{types-ByodIyEv.d.cts → types-Czt887Iv.d.cts} +19 -3
- package/dist/{types-ByodIyEv.d.ts → types-Czt887Iv.d.ts} +19 -3
- package/dist/use-cache.d.cts +2 -2
- package/dist/use-cache.d.ts +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -77,7 +77,7 @@ export const GET = () => hyleFeed({ ...options, siteOrigin: "https://tdacorp.in"
|
|
|
77
77
|
|---|---|---|
|
|
78
78
|
| `@tdacorp/hyle-sdk` | `createHyleClient` (typed `resolve`, `mounts` and `asset`), `listPublicationPaths`, `checkRoutes` and the other route-check functions, `Cp1ClientError`, `verifyHyleSignature`, `parseSignatureHeader`, `isValidCacheTag`, `DeliveryDedupe`, `createRevalidationCallbackRoute`, the result types | nothing (no framework) |
|
|
79
79
|
| `@tdacorp/hyle-sdk/react` | `ArticlePage`, `Comments`, `ListPage`, `HyleListView`, `HyleArticleView`, `DocsPage`, `NotFound`, `Redirecting`, `Unavailable`, `HastContent`, `TrustedServerHtml`, `sanitizeHast` | react >= 19 |
|
|
80
|
-
| `@tdacorp/hyle-sdk/next` | `hylePage`, `hyleMetadata`, `hyleSitemap`, `hyleFeed`, `hyleRootPage`, `hyleRootMetadata`, `hyleRootSitemap`, `createMarkdownRoute`, `markdownRewritePath`, `createLlmsTxtRoute`, `createRevalidateRoute`, `createAssetRoute`, `createEngagementRoute`, `HyleList`, `HyleArticle`, `HyleComments`, `HyleCommentsFallback`, `fetchResolver`, `workspaceTags` | next >= 16 |
|
|
80
|
+
| `@tdacorp/hyle-sdk/next` | `hylePage`, `hyleMetadata`, `hyleSitemap`, `hyleFeed`, `hyleRootPage`, `hyleRootMetadata`, `hyleRootSitemap`, `createMarkdownRoute`, `markdownRewritePath`, `createLlmsTxtRoute`, `createRevalidateRoute`, `createAssetRoute`, `createOgImageRoute`, `createEngagementRoute`, `HyleList`, `HyleArticle`, `HyleComments`, `HyleCommentsFallback`, `fetchResolver`, `workspaceTags` | next >= 16 |
|
|
81
81
|
| `@tdacorp/hyle-sdk/next/use-cache` | `cachedResolver` | next >= 16 with `cacheComponents: true` |
|
|
82
82
|
| `@tdacorp/hyle-sdk/styles.css` | the stylesheet | |
|
|
83
83
|
|
|
@@ -120,7 +120,7 @@ The revalidate route expires tags immediately (`revalidateTag(tag, { expire: 0 }
|
|
|
120
120
|
|
|
121
121
|
`list: { title, description }` sets the list page's h1, `<title>`, description and Open Graph. Each wins over hyle's section title (which is the slug, "Posts") and falls back separately: no `list.title` keeps the section title, no `list.description` shows none. Articles are unaffected.
|
|
122
122
|
|
|
123
|
-
List pages show the first page of results (`listLimit`, server default 20, maximum 100). `paginate: "searchParams"` turns on cursor pagination: `?cursor=` is read (it must be 1 to 256 characters of `A-Za-z0-9_-`, otherwise it is ignored; a well-formed cursor hyle rejects is a 404), sent to hyle, and "Older posts" links to `?cursor=<next_cursor>`. It is off by default because reading `searchParams` makes the route dynamic: it can no longer be statically generated or served from ISR (hyle's fetch cache and tags still apply per request). Leave it off when one page is enough. `generateMetadata`
|
|
123
|
+
List pages show the first page of results (`listLimit`, server default 20, maximum 100). `paginate: "searchParams"` turns on cursor pagination: `?cursor=` is read (it must be 1 to 256 characters of `A-Za-z0-9_-`, otherwise it is ignored; a well-formed cursor hyle rejects is a 404), sent to hyle, and "Older posts" links to `?cursor=<next_cursor>`. It is off by default because reading `searchParams` makes the route dynamic: it can no longer be statically generated or served from ISR (hyle's fetch cache and tags still apply per request). Leave it off when one page is enough. `generateMetadata` reads the cursor too (also under `hyleRootMetadata`), so page 2 has its own canonical and an "Older posts" title suffix.
|
|
124
124
|
|
|
125
125
|
## Errors
|
|
126
126
|
|
|
@@ -134,6 +134,10 @@ How `hylePage` treats a hyle failure is chosen so a bad moment never replaces a
|
|
|
134
134
|
|
|
135
135
|
Why rethrow: a rendered "unavailable" page is a normal 200 render, so ISR would cache it and replace the last good article for everyone for the revalidate window. `onError: (error) => ReactElement` is the opt-in for a custom UI anyway; its element IS cached like any render, and the `error` it receives can contain `Cp1ClientError.message` and `requestId`, so never render it (only its name is logged, never the token or message). The `Unavailable` component (en, fr, es; `data-hyle-page="unavailable"`, `role="status"`, no error text) is exported from `./react` for `onError` or your own `error.tsx`. `hyleMetadata` follows the same split: a 4xx rejection gives `{}`, anything else is rethrown, so a transient outage never caches a noindex page.
|
|
136
136
|
|
|
137
|
+
### More in this section
|
|
138
|
+
|
|
139
|
+
`related: { limit?, title? }` (layout "article") adds a "More in this section" list after the pager: one extra request for the article's section path (the first breadcrumb, else `basePath`) with `limit + 1` (default limit 5), the current article left out, rendered with `HyleListView`. An article's own child pages follow under "In this section". The request goes through the page's resolver, so it carries the same cache tags and a purge refreshes both. If it fails, the block is omitted and the page still renders. Backlinks are not read.
|
|
140
|
+
|
|
137
141
|
## Sitemap
|
|
138
142
|
|
|
139
143
|
The contract has no "list every page" endpoint, so the helper pages the list result at each section index (100 per page, `next_cursor`, at most 20 pages per index by default). Spread it into your sitemap:
|
|
@@ -239,10 +243,15 @@ Checklist for a site that mounts hyle at the root (details in the sections named
|
|
|
239
243
|
|
|
240
244
|
- A REQUIRED catch-all `app/(site)/[...hyle]/page.tsx` (not `[[...hyle]]`), see "Root catch-all". A single mount that you name (`hylePage` at `/learn`) needs only its own route.
|
|
241
245
|
- `app/api/hyle/assets/[file]/route.ts` exporting `GET` and `HEAD` from `createAssetRoute`, if content has images, video or audio, see "Media".
|
|
246
|
+
- `app/api/hyle/og/[...path]/route.ts` exporting `GET` from `createOgImageRoute(options)` (the same options as `hylePage`), and `ogImageRoute: true` in the page options, if you want the default card (needs `siteOrigin`, no `ogImage`): it draws the 1200x630 card, see "Not included". `/api/hyle/og` is reserved by the SDK.
|
|
242
247
|
- hyle's reserved paths must cover `/api/hyle/*` and your other routes: run `hyle-sdk-check-routes --sync` after `next build` (needs `HYLE_CONTROL_TOKEN`), see "Syncing reserved paths".
|
|
243
248
|
- No parent layout or page above the mount may export `dynamicParams = false` (below).
|
|
244
249
|
- Optional, for AI readers: the `.md` twin and `llms.txt` (next section).
|
|
245
250
|
|
|
251
|
+
### Feed and markdown discovery
|
|
252
|
+
|
|
253
|
+
`feed: { path, title? }` (a path, or `(locale) => path`) adds `<link rel="alternate" type="application/rss+xml">` to article and list metadata, absolute when `siteOrigin` is set, merged with the host's own `alternates.types`. The path is used as given and is not localized (`localePrefix` is not applied): return the locale's own feed path from the function form if feeds are per-locale. On `hyleRootMetadata`, `feed` and `markdownTwin` set on a root config apply to every mount. `title` defaults to "<siteName> feed", else "Feed". For a host-owned page (for example one using `HyleList`, which emits nothing in the head), `hyleFeedLink(options, locale)` returns the same `{ url, title }`. `markdownTwin: true` (set it when the markdown route below is mounted) adds `<link rel="alternate" type="text/markdown">` to `<canonical>.md` on article pages only; the twin stays noindex and is not in the sitemap.
|
|
254
|
+
|
|
246
255
|
### Markdown twins, llms.txt and per-locale feeds (optional)
|
|
247
256
|
|
|
248
257
|
`app/api/hyle/md/[...path]/route.ts` (under `[locale]` for a locale-prefixed site, so `locale(params)` works):
|
|
@@ -337,7 +346,7 @@ import { HyleArticle, HyleComments, HyleCommentsFallback, HyleList } from "@tdac
|
|
|
337
346
|
</Suspense>
|
|
338
347
|
```
|
|
339
348
|
|
|
340
|
-
- `HyleList`: `limit` (default 5, at most 100), `layout` (`"list"` or `"grid"`, default list), `title`, `headingLevel` (2, 3 or 4, default 2), `moreHref` (a "View all" link to a URL you choose, usually the mount) and `locale` (needed when `options.locale` is a function of route params, which a component cannot evaluate). It is a flat list, newest first, with no month groups and
|
|
349
|
+
- `HyleList`: `limit` (default 5, at most 100), `layout` (`"list"` or `"grid"`, default list), `title`, `headingLevel` (2, 3 or 4, default 2), `moreHref` (a "View all" link to a URL you choose, usually the mount) and `locale` (needed when `options.locale` is a function of route params, which a component cannot evaluate). It is a flat list, newest first, with no month groups. Pagination is opt-in: `cursor` (the page's `?cursor=`) starts after a `next_cursor`, and `olderHref={(next) => `/blog?cursor=${next}`}` is called with the list's `next_cursor`, when there is one, to build the "Older posts" link. The slots `list.item` and `list.empty` of `options.slots` apply. The `list.item` slot's item also carries the document's authored fields when the server sends them: `tags` (slug tokens), `kicker`, `status` (a free label), `cover` (`{ path }`, root-relative `/assets/<id>`, or `null`) and `author` (`{ name, url }` or `null`); an older server omits them. An article's `publication` carries the same fields, and its `author` is the byline used for the page metadata and JSON-LD ahead of `jsonLd.author` and `frontmatter.author`.
|
|
341
350
|
- `HyleArticle`: `path`, `headingLevel` (default 2), `locale`. Title, date, description, the body, and a visible "Read at source" link. No table of contents, pager, languages bar, comments or JSON-LD. A path that is not an article (a redirect included) renders nothing.
|
|
342
351
|
- `HyleComments`: `options: { baseUrl, token, locale? }`, `path` (the article's canonical path), `revalidate` (seconds, default 60) and `interactive`. The listing is public and cached for `revalidate` seconds, not purged by a webhook. It renders the thread as server HTML (`ol > li > article`, names, dates, sanitized bodies, links `rel="nofollow ugc"`, removed comments as tombstones) and nothing at all when there are no comments or hyle answers 404 (engagement off, unknown article) or fails. With `interactive` (`true`, or `{ endpoint?, signInHref? }`) the `Comments` island is rendered INSTEAD, seeded from the same listing: the thread is still in the server HTML, there is no skeleton flash, readers can comment and like (it needs `createEngagementRoute`, as in "Comments and likes"), and it refetches silently on mount. The listing is serialized once into the page for the island (up to 500 comments), so leave `interactive` off where you only need to show comments.
|
|
343
352
|
|
|
@@ -359,7 +368,8 @@ Zero setup. A Mermaid fence arrives from hyle as a sandboxed `<iframe srcdoc>` t
|
|
|
359
368
|
- What loads when: the server renders a no-JavaScript fallback, a `<figure class="hyle-mermaid">` holding the source as a `language-mermaid` code block. On a page with a diagram, the browser then imports `mermaid` (a dynamic import, so your bundler emits it as lazy chunks served from your own origin) and swaps in the SVG. Pages without a diagram never load it: the client component is not even in their JavaScript. In the e2e app (Next 16.2.7, Turbopack) the lazy chunks total about 2.8 MB raw, 0.8 MB gzipped across every diagram type; a page loads only the ones its diagram type needs. `mermaid` itself is 64 MB on disk in `node_modules` (it is not shipped to browsers).
|
|
360
369
|
- Rendering: a diagram renders when it is within 200 px of the viewport, one at a time, each limited to 10 s (a slower one falls back to the code block and the note). Per-diagram configuration (`%%{init}%%` directives and frontmatter) is stripped, see Security model. A re-render (theme change) keeps the previous SVG on screen until the new one is ready, and keeps it if the new one fails.
|
|
361
370
|
- Themes: dark or default is chosen from the figure's computed background (falling back to `prefers-color-scheme`), and the diagram re-renders when `data-act`, `data-theme` or `class` change on `<html>` or the OS scheme changes.
|
|
362
|
-
-
|
|
371
|
+
- Stored renders: when hyle has a pre-rendered image of the diagram in both themes (the editor renders it in the author's browser, hyle sanitizes and stores it, ADR 0024), the page gets a sized `<img>` (aspect ratio reserved, so no layout shift), the diagram source in a `<details>` for crawlers and no-JS readers, and no Mermaid layout runs in any browser. The image goes through your asset route (`createAssetRoute`, `img-src 'self'`). Click-to-expand fetches that same sanitized SVG for the viewer. If the image fails to load, or hyle has no stored render yet, the page renders the diagram client-side as above, with a loader and a reserved height.
|
|
372
|
+
- A source that is not the renderer's template is dropped. There is no length cap on the diagram beyond the 1 MiB `srcdoc` guard, and no cdnjs frame. If Mermaid cannot render the source (a syntax error), the code block stays and a short "diagram could not be rendered" note appears.
|
|
363
373
|
- Host CSP: `script-src 'self'` is enough (plus `'unsafe-inline'` or nonces for Next's own inline scripts, as for any Next app); `style-src 'unsafe-inline'` is required because Mermaid's SVG carries inline styles; `img-src` decides whether images that a diagram label references load. Checked under `default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data:` in headless Chromium on Next 16.2.7, 16.3.4 and 16.4.2 (`node scripts/e2e-next-build.mjs --browser`).
|
|
364
374
|
- Override: `components.Mermaid` still replaces all of this. It receives `{ srcDoc, source, title }`; `source` is the diagram text, or `undefined` when it could not be extracted. `MermaidDiagram` (`{ source, title, errorText }`) is exported from `./react` if you want to wrap it. It is the SDK's only client component and takes nothing but those strings: no token or client ever crosses the boundary.
|
|
365
375
|
|
|
@@ -417,17 +427,19 @@ Chrome strings exist for en, fr and es (fr and es are unreviewed drafts). The pa
|
|
|
417
427
|
|
|
418
428
|
- The token is sent only as an `Authorization` header from the server. It is never placed in a URL, logged or put in an error message. Keep it out of client components. The client requires an https `baseUrl` (http only for localhost, or with `allowInsecureHttp`), refuses redirects, aborts after `timeoutMs` (default 10 s) and refuses responses over `maxResponseBytes` (default 5 MiB).
|
|
419
429
|
- The path is sent as a query parameter (encoded once); catch-all segments are decoded and refused if they contain `/`, `\`, control characters, `.` or `..`.
|
|
420
|
-
- The `hast` tree is rendered through an allowlist (`sanitizeHast`) even though hyle sanitizes server-side: only known tags and properties with accepted value shapes survive; no `on*` attributes, `style` only inside KaTeX output and only for the properties KaTeX emits with small values (no `position:absolute`, `z-index`, `left` or large sizes), ids and in-page fragments scoped with the server's `user-content-` prefix (so heading ids, footnote links and TOC links still resolve), `href` and `src` limited to site-relative paths and `http(s)` (and `mailto` for links), unknown tags are unwrapped, `script` and `style` are dropped, and an `iframe` is kept only with `sandbox="allow-scripts"` and a `srcdoc` that is exactly the document hyle's renderer builds for a Mermaid fence (pinned script URL, at most
|
|
421
|
-
- Mermaid renders into your page, so: the source comes only from hyle content, passes the exact-template check and
|
|
430
|
+
- The `hast` tree is rendered through an allowlist (`sanitizeHast`) even though hyle sanitizes server-side: only known tags and properties with accepted value shapes survive; no `on*` attributes, `style` only inside KaTeX output and only for the properties KaTeX emits with small values (no `position:absolute`, `z-index`, `left` or large sizes), ids and in-page fragments scoped with the server's `user-content-` prefix (so heading ids, footnote links and TOC links still resolve), `href` and `src` limited to site-relative paths and `http(s)` (and `mailto` for links), unknown tags are unwrapped, `script` and `style` are dropped, and an `iframe` is kept only with `sandbox="allow-scripts"` and a `srcdoc` that is exactly the document hyle's renderer builds for a Mermaid fence (pinned script URL, at most 1 MiB); the SDK never renders that frame, it only reads the diagram text out of it. `data-light` and `data-dark` on it are kept only as `/assets/<uuid>.svg <width> <height>`. A tree over 20,000 nodes or 512 KiB of text fails closed with `HastLimitError` and a safe notice. `dangerouslySetInnerHTML` is used in exactly three places: the Mermaid SVG sink (below), the same SVG with rewritten ids in the diagram viewer's stage (below), and `TrustedServerHtml`, the escape hatch for `content.format === "html"`: it renders HTML as is, so pass it only HTML that came straight from hyle's resolve endpoint, never user input.
|
|
431
|
+
- Mermaid renders into your page, so: the source comes only from hyle content, passes the exact-template check and the 1 MiB `srcdoc` guard, and is rendered with `securityLevel: "strict"` (Mermaid's own DOMPurify pass, no raw HTML labels), `maxTextSize` set to that bound and `maxEdges` 5000. The SDK strips every `%%{ ... }%%` directive (multi-line, unterminated and `init`, `initialize`, `config`, `wrap` forms) and a leading YAML frontmatter block from the source before rendering, and keeps plain `%% comment` lines. Reason: Mermaid's `themeCSS` (set by a directive or by frontmatter `config:`) is injected into the page as CSS and its sanitizer only checks brace balance, so a diagram could make the page fetch a URL or overlay the host UI; verified against Mermaid 11.9.0 with a loopback canary server, which received requests when the stripping was disabled and none with it. Consequence: authors cannot configure a diagram per diagram; a diagram that carries an init directive renders with the SDK's defaults. As a second guard `.hyle-mermaid-svg` uses `contain: paint` and the SVG is `position: static !important`, so diagram CSS cannot place anything over the host page. Flowchart `style` and `classDef` lines cannot carry `url(...)` (they fail to parse). What remains: Mermaid keeps an `<img>` inside a label (event handlers are stripped), so an author can make the page request an image, and your CSP `img-src` governs that exactly as for Markdown images (the e2e proves a strict `img-src 'self' data:` stops it); a `click A "https://..."` line makes a clickable link, a phishing-link capability inside author-controlled content, so treat hyle authors as trusted to link. Nothing is executed: the SDK ignores Mermaid's `bindFunctions`, and the hostile `click ... call`, `<img onerror>` and `securityLevel: "loose"` payloads did nothing in the browser check. The host CSP needs `style-src 'unsafe-inline'`.
|
|
422
432
|
- The diagram viewer adds no network request, no `eval`, no storage and no new way to write HTML: its stage receives the very string the inline diagram holds (Mermaid's strict-mode DOMPurify output) after one rewrite of the SDK-generated render id (`hyle-mermaid-N`) to another SDK-generated token (`hyle-viewer-N`), applied only inside tags and `<style>` bodies and only for `[\w-]+` tokens, so it cannot add a quote, a tag or a script; the node and edge decoration only sets classes, `tabindex`, `role` and `aria-*` on elements that already exist. Export builds `blob:` and `data:` URLs from that same string on click, and the clipboard is only touched inside the click that asked for it. A unit test pins these properties by reading the viewer's source (no `fetch`, `eval`, `innerHTML =`, storage or `document.write`, exactly one `dangerouslySetInnerHTML`).
|
|
423
433
|
- The comments client talks only to the host's own `createEngagementRoute` (same origin; no credential, no hyle URL, no storage, no cookie access in the browser bundle, which a test pins). The route is an allowlist, not a proxy, and writes need same-origin plus a custom header (see "Comments and likes"). The private signing key stays on the server and is never logged; a malformed key is refused with a message that does not contain it.
|
|
424
434
|
- Webhooks are verified with HMAC-SHA256 over the raw body (read with a running 64 KiB cap), a 300 s timestamp tolerance and constant-time comparison, with dual-secret rotation (empty secrets are never candidates), a payload shape check (400, not 500), tag validation, and delivery-id dedupe that records an id only after every purge succeeded, so a failed delivery can be retried.
|
|
425
435
|
|
|
426
436
|
## Not included
|
|
427
437
|
|
|
428
|
-
Docs versions,
|
|
438
|
+
Docs versions, "closest matches" on the 404 page and a copy-code button: hyle does not provide that data or the page would need client JavaScript. Image URLs in content such as `/assets/<id>` are no longer passed through unchanged: see "Media".
|
|
439
|
+
|
|
440
|
+
Reading time: when the server sends `publication.word_count` (a positive integer; older servers omit it), article pages show the locale's "N min read" in the meta row (275 words per minute, at least 1), the BlogPosting carries `wordCount`, and the metadata adds `twitter:label1`/`twitter:data1` through `other`, keeping the host's own `other` keys read from `parent`. Nothing is shown or emitted without it.
|
|
429
441
|
|
|
430
|
-
Social card images (`og:image`): the resolve contract carries no image data, so `
|
|
442
|
+
Social card images (`og:image`): the resolve contract carries no image data. Set `ogImage` to supply one per article. With `ogImageRoute: true` (off by default, because an unmounted route would 404), no `ogImage` and a valid `siteOrigin`, article metadata points at `/api/hyle/og/<canonical path>?locale=<locale>&v=<edit time>` (1200x630; `v` busts the year-long cache when the title changes) and the BlogPosting `image` is an ImageObject with that size; mount it first with `export const { GET } = createOgImageRoute(options)` in `app/api/hyle/og/[...path]/route.ts`. The card is cached for a year at the edge (`s-maxage`, `immutable`) and the route answers 404 when `HYLE_CONTENT_ENABLED=0`; `?locale=` is used only when it names a translation of the article. The card renderer (`next/og`) fetches Google Fonts and emoji assets from third parties at render time for non-Latin titles and emoji, so hosts with an egress allowlist should not enable `ogImageRoute`. The card is the title and `siteName` on a plain background in the system font, resolved from the article's canonical path (any mount, any locale section; a renamed slug redirects as the page does). List pages emit `og:type`, `og:url`, `og:site_name` and `og:locale`; the host layout's `og:image` is read from `parent` and passed through. To add your own image by hand, wrap the returned function:
|
|
431
443
|
|
|
432
444
|
```ts
|
|
433
445
|
import { hyleMetadata, type PageProps } from "@tdacorp/hyle-sdk/next";
|
package/dist/check-routes-bin.js
CHANGED
|
@@ -530,16 +530,18 @@ async function runCli(argv, io) {
|
|
|
530
530
|
io.err("CANNOT RUN: set HYLE_TARGET_BASE_URL (or --base-url) and HYLE_TARGET_TOKEN");
|
|
531
531
|
return CANNOT_RUN;
|
|
532
532
|
}
|
|
533
|
-
const hylePaths =
|
|
534
|
-
for (const { prefix } of mounts.mounts) {
|
|
535
|
-
const
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
533
|
+
const hylePaths = /* @__PURE__ */ new Set();
|
|
534
|
+
for (const { prefix, locales } of mounts.mounts) {
|
|
535
|
+
for (const locale2 of locales?.length ? locales : [void 0]) {
|
|
536
|
+
const listing = await listPublicationPaths({ client, basePath: normalizeBasePath(prefix), maxPages: 100, ...locale2 !== void 0 ? { locale: locale2 } : {} });
|
|
537
|
+
if (!listing.complete) {
|
|
538
|
+
io.err(`CANNOT RUN: hyle's pages under ${printable(prefix)} could not be listed completely, so a collision could be missed`);
|
|
539
|
+
return CANNOT_RUN;
|
|
540
|
+
}
|
|
541
|
+
listing.paths.forEach((p) => hylePaths.add(p.path));
|
|
539
542
|
}
|
|
540
|
-
hylePaths.push(...listing.paths.map((p) => p.path));
|
|
541
543
|
}
|
|
542
|
-
const report = checkRoutes({ hostRoutes, mounts: mounts.mounts.map((m) => m.prefix), hylePaths, hyleParam, ...locale ? { locale } : {} });
|
|
544
|
+
const report = checkRoutes({ hostRoutes, mounts: mounts.mounts.map((m) => m.prefix), hylePaths: [...hylePaths], hyleParam, ...locale ? { locale } : {} });
|
|
543
545
|
io.out(args.has("--json") ? JSON.stringify(sync ? { ...report, sync } : report, null, 2) : formatReport(report));
|
|
544
546
|
if (!report.ok) return 1;
|
|
545
547
|
return sync?.status === "failed" && strict ? SYNC_FAILED : 0;
|