@tdacorp/hyle-sdk 0.11.0 → 0.12.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 +32 -1
- package/dist/{chunk-S3LT6G4M.js → chunk-ZQFYH4FX.js} +3 -1
- package/dist/{embed-CwSzvBUO.d.ts → embed-DL5QIZRJ.d.ts} +1 -1
- package/dist/{embed-BC8Tlc6A.d.cts → embed-jCaSI31t.d.cts} +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/next.cjs +74 -24
- package/dist/next.d.cts +21 -7
- package/dist/next.d.ts +21 -7
- package/dist/next.js +56 -7
- package/dist/react.cjs +2 -1
- package/dist/react.d.cts +3 -3
- package/dist/react.d.ts +3 -3
- package/dist/react.js +1 -1
- package/dist/{resolve-BYL8jMg0.d.ts → resolve-DvmuBlpO.d.ts} +1 -1
- package/dist/{resolve-Ra8-y2U-.d.cts → resolve-f6IJ6SL9.d.cts} +1 -1
- package/dist/{types-C72FwzOd.d.cts → types-5D6ZD0Wi.d.cts} +2 -0
- package/dist/{types-C72FwzOd.d.ts → types-5D6ZD0Wi.d.ts} +2 -0
- 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
|
@@ -52,13 +52,32 @@ export const { GET, HEAD } = createAssetRoute({ baseUrl: process.env.HYLE_TARGET
|
|
|
52
52
|
|
|
53
53
|
Register the revalidate URL as the workspace's webhook endpoint in hyle. Set `metadataBase` in your root layout so canonical and hreflang URLs are absolute.
|
|
54
54
|
|
|
55
|
+
## RSS feed
|
|
56
|
+
|
|
57
|
+
`hyleFeed` answers an RSS 2.0 feed of the newest articles of the mount's default section. Mount it as a route handler and give it the same options as `hylePage`, plus the site's public origin (feeds need absolute URLs).
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
// app/feed.xml/route.ts
|
|
61
|
+
import { hyleFeed } from "@tdacorp/hyle-sdk/next";
|
|
62
|
+
import { options } from "../hyle-options";
|
|
63
|
+
|
|
64
|
+
export const revalidate = 300;
|
|
65
|
+
export const GET = () => hyleFeed({ ...options, siteOrigin: "https://tdacorp.in", limit: 50 });
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
- `siteOrigin` must be a bare https origin (the same rule as the JSON-LD). Without a valid one the route logs once and answers 404.
|
|
69
|
+
- `limit` defaults to 50 (the server maximum is 100). `feedPath` (default `/feed.xml`) is where you mounted the route; it only fills `<atom:link rel="self">`.
|
|
70
|
+
- The channel title and description come from `list.title` and `list.description`, else hyle's section title. Each item carries the title, the link on the mount (through `localePrefix`), a permalink `guid` equal to the link, `pubDate` from `published_at` and the description when there is one. Every value is XML-escaped, and an item whose `canonical_path` does not start with `/` is dropped.
|
|
71
|
+
- The list is read through the same resolver as `hylePage`, so it shares its fetch cache and publish tags. `export const revalidate` is Next's own route-handler setting and decides how long Next keeps the generated XML; the SDK adds no `cache-control`.
|
|
72
|
+
- A hyle failure answers 503 with an empty body instead of throwing; Next control flow still propagates.
|
|
73
|
+
|
|
55
74
|
## Entry points
|
|
56
75
|
|
|
57
76
|
| Import | Contents | Needs |
|
|
58
77
|
|---|---|---|
|
|
59
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) |
|
|
60
79
|
| `@tdacorp/hyle-sdk/react` | `ArticlePage`, `Comments`, `ListPage`, `HyleListView`, `HyleArticleView`, `DocsPage`, `NotFound`, `Redirecting`, `Unavailable`, `HastContent`, `TrustedServerHtml`, `sanitizeHast` | react >= 19 |
|
|
61
|
-
| `@tdacorp/hyle-sdk/next` | `hylePage`, `hyleMetadata`, `hyleSitemap`, `hyleRootPage`, `hyleRootMetadata`, `hyleRootSitemap`, `createRevalidateRoute`, `createAssetRoute`, `createEngagementRoute`, `HyleList`, `HyleArticle`, `HyleComments`, `HyleCommentsFallback`, `fetchResolver`, `workspaceTags` | next >= 16 |
|
|
80
|
+
| `@tdacorp/hyle-sdk/next` | `hylePage`, `hyleMetadata`, `hyleSitemap`, `hyleFeed`, `hyleRootPage`, `hyleRootMetadata`, `hyleRootSitemap`, `createRevalidateRoute`, `createAssetRoute`, `createEngagementRoute`, `HyleList`, `HyleArticle`, `HyleComments`, `HyleCommentsFallback`, `fetchResolver`, `workspaceTags` | next >= 16 |
|
|
62
81
|
| `@tdacorp/hyle-sdk/next/use-cache` | `cachedResolver` | next >= 16 with `cacheComponents: true` |
|
|
63
82
|
| `@tdacorp/hyle-sdk/styles.css` | the stylesheet | |
|
|
64
83
|
|
|
@@ -386,6 +405,18 @@ Chrome strings exist for en, fr and es (fr and es are unreviewed drafts). The pa
|
|
|
386
405
|
|
|
387
406
|
Docs versions, reading time, "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".
|
|
388
407
|
|
|
408
|
+
Social card images (`og:image`): the resolve contract carries no image data, so `hyleMetadata` emits none. Add your own by wrapping the returned function:
|
|
409
|
+
|
|
410
|
+
```ts
|
|
411
|
+
import { hyleMetadata, type PageProps } from "@tdacorp/hyle-sdk/next";
|
|
412
|
+
|
|
413
|
+
const base = hyleMetadata(options);
|
|
414
|
+
export async function generateMetadata(props: PageProps) {
|
|
415
|
+
const meta = await base(props);
|
|
416
|
+
return { ...meta, openGraph: { ...meta.openGraph, images: ["/og.png"] } };
|
|
417
|
+
}
|
|
418
|
+
```
|
|
419
|
+
|
|
389
420
|
## Contract
|
|
390
421
|
|
|
391
422
|
Types in `src/types.ts` mirror `packages/cp1-read/src/resolve.ts`. `src/__tests__/contract.test.ts` pins them against fixture JSON for every result kind, so a server-side shape change fails a test here.
|
|
@@ -866,7 +866,8 @@ function articleJsonLd(article, origin, c, author) {
|
|
|
866
866
|
headline: pub.title,
|
|
867
867
|
...pub.description ? { description: pub.description } : {},
|
|
868
868
|
datePublished: pub.published_at,
|
|
869
|
-
|
|
869
|
+
// a save before the publish leaves updated_at earlier than published_at; dateModified before datePublished is invalid
|
|
870
|
+
...pub.updated_at && !(Date.parse(pub.updated_at) < Date.parse(pub.published_at)) ? { dateModified: pub.updated_at } : {},
|
|
870
871
|
...author ? { author: { "@type": "Person", name: author } } : {},
|
|
871
872
|
inLanguage: pub.locale,
|
|
872
873
|
mainEntityOfPage: url(pub.canonical_path)
|
|
@@ -1368,6 +1369,7 @@ export {
|
|
|
1368
1369
|
stringsFor,
|
|
1369
1370
|
HastContent,
|
|
1370
1371
|
TrustedServerHtml,
|
|
1372
|
+
BARE_HTTPS_ORIGIN,
|
|
1371
1373
|
ArticlePage,
|
|
1372
1374
|
ListPage,
|
|
1373
1375
|
NotFound,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ElementType, ReactNode, ComponentType, ReactElement } from 'react';
|
|
2
|
-
import { L as ListItem, h as ResolvedArticle } from './types-
|
|
2
|
+
import { L as ListItem, h as ResolvedArticle } from './types-5D6ZD0Wi.js';
|
|
3
3
|
|
|
4
4
|
type CalloutKind = "note" | "tip" | "warning" | "caution";
|
|
5
5
|
interface LinkProps {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ElementType, ReactNode, ComponentType, ReactElement } from 'react';
|
|
2
|
-
import { L as ListItem, h as ResolvedArticle } from './types-
|
|
2
|
+
import { L as ListItem, h as ResolvedArticle } from './types-5D6ZD0Wi.cjs';
|
|
3
3
|
|
|
4
4
|
type CalloutKind = "note" | "tip" | "warning" | "caution";
|
|
5
5
|
interface LinkProps {
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as Resolved, M as MountsResult } from './types-
|
|
2
|
-
export { A as Alternate, a as ArticleContent, B as Breadcrumb, C as CacheInfo, E as EngageComment, b as EngageHeldComment, c as EngageListing, F as Fallback, L as ListItem, d as Mount, e as Mounts, N as NavItem, f as NavNode, g as NavTree, h as ResolvedArticle, i as ResolvedDisabled, j as ResolvedList, k as ResolvedNotFound, l as ResolvedRedirect, T as TocEntry } from './types-
|
|
1
|
+
import { R as Resolved, M as MountsResult } from './types-5D6ZD0Wi.cjs';
|
|
2
|
+
export { A as Alternate, a as ArticleContent, B as Breadcrumb, C as CacheInfo, E as EngageComment, b as EngageHeldComment, c as EngageListing, F as Fallback, L as ListItem, d as Mount, e as Mounts, N as NavItem, f as NavNode, g as NavTree, h as ResolvedArticle, i as ResolvedDisabled, j as ResolvedList, k as ResolvedNotFound, l as ResolvedRedirect, T as TocEntry } from './types-5D6ZD0Wi.cjs';
|
|
3
3
|
export { R as RevalidationCallbackOptions, a as RevalidationCallbackRoute, b as RevalidationPayload, c as createRevalidationCallbackRoute } from './revalidation-callback-D7Ms_Puz.cjs';
|
|
4
4
|
|
|
5
5
|
/** `next` is a Next.js fetch extension with no lib.dom type; typed structurally so this module needs no Next import. */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as Resolved, M as MountsResult } from './types-
|
|
2
|
-
export { A as Alternate, a as ArticleContent, B as Breadcrumb, C as CacheInfo, E as EngageComment, b as EngageHeldComment, c as EngageListing, F as Fallback, L as ListItem, d as Mount, e as Mounts, N as NavItem, f as NavNode, g as NavTree, h as ResolvedArticle, i as ResolvedDisabled, j as ResolvedList, k as ResolvedNotFound, l as ResolvedRedirect, T as TocEntry } from './types-
|
|
1
|
+
import { R as Resolved, M as MountsResult } from './types-5D6ZD0Wi.js';
|
|
2
|
+
export { A as Alternate, a as ArticleContent, B as Breadcrumb, C as CacheInfo, E as EngageComment, b as EngageHeldComment, c as EngageListing, F as Fallback, L as ListItem, d as Mount, e as Mounts, N as NavItem, f as NavNode, g as NavTree, h as ResolvedArticle, i as ResolvedDisabled, j as ResolvedList, k as ResolvedNotFound, l as ResolvedRedirect, T as TocEntry } from './types-5D6ZD0Wi.js';
|
|
3
3
|
export { R as RevalidationCallbackOptions, a as RevalidationCallbackRoute, b as RevalidationPayload, c as createRevalidationCallbackRoute } from './revalidation-callback-D7Ms_Puz.js';
|
|
4
4
|
|
|
5
5
|
/** `next` is a Next.js fetch extension with no lib.dom type; typed structurally so this module needs no Next import. */
|
package/dist/next.cjs
CHANGED
|
@@ -30,6 +30,7 @@ __export(next_exports, {
|
|
|
30
30
|
createEngagementRoute: () => createEngagementRoute,
|
|
31
31
|
createRevalidateRoute: () => createRevalidateRoute,
|
|
32
32
|
fetchResolver: () => fetchResolver,
|
|
33
|
+
hyleFeed: () => hyleFeed,
|
|
33
34
|
hyleMetadata: () => hyleMetadata,
|
|
34
35
|
hylePage: () => hylePage,
|
|
35
36
|
hyleRootMetadata: () => hyleRootMetadata,
|
|
@@ -253,8 +254,8 @@ function verifyHyleSignature(params) {
|
|
|
253
254
|
|
|
254
255
|
// src/tag-validation.ts
|
|
255
256
|
var CACHE_TAG_PATTERN = /^hyle:1:(pub|doc|sec|link|ws):[0-9a-f-]{36}(:[\x21-\x7e]{1,200})?$/;
|
|
256
|
-
function isValidCacheTag(
|
|
257
|
-
return CACHE_TAG_PATTERN.test(
|
|
257
|
+
function isValidCacheTag(tag2) {
|
|
258
|
+
return CACHE_TAG_PATTERN.test(tag2);
|
|
258
259
|
}
|
|
259
260
|
|
|
260
261
|
// src/revalidation-callback.ts
|
|
@@ -300,9 +301,9 @@ function createRevalidationCallbackRoute(options) {
|
|
|
300
301
|
}
|
|
301
302
|
let purged = 0;
|
|
302
303
|
try {
|
|
303
|
-
for (const
|
|
304
|
-
if (!isValidCacheTag(
|
|
305
|
-
options.revalidateTag(
|
|
304
|
+
for (const tag2 of tags) {
|
|
305
|
+
if (!isValidCacheTag(tag2)) continue;
|
|
306
|
+
options.revalidateTag(tag2);
|
|
306
307
|
purged += 1;
|
|
307
308
|
}
|
|
308
309
|
} catch {
|
|
@@ -600,10 +601,10 @@ function clean(node, depth, ctx2, budget) {
|
|
|
600
601
|
return [{ type: "text", value: node.value }];
|
|
601
602
|
}
|
|
602
603
|
if (node.type !== "element" || typeof node.tagName !== "string" || DROP.has(node.tagName)) return [];
|
|
603
|
-
const
|
|
604
|
-
const rules = ATTRS.get(
|
|
604
|
+
const tag2 = node.tagName;
|
|
605
|
+
const rules = ATTRS.get(tag2);
|
|
605
606
|
const own = isObject(node.properties) ? classTokens(node.properties.className) : void 0;
|
|
606
|
-
const inner =
|
|
607
|
+
const inner = tag2 === "span" && own?.some((t) => t === "katex" || t.startsWith("katex-")) ? { katex: true } : ctx2;
|
|
607
608
|
const children = Array.isArray(node.children) ? node.children.flatMap((c) => clean(c, depth + 1, inner, budget)) : [];
|
|
608
609
|
if (!rules) return children;
|
|
609
610
|
const properties = {};
|
|
@@ -612,23 +613,23 @@ function clean(node, depth, ctx2, budget) {
|
|
|
612
613
|
if (Object.hasOwn(rules, key) && rules[key](value, inner)) properties[key] = value;
|
|
613
614
|
}
|
|
614
615
|
}
|
|
615
|
-
if ((
|
|
616
|
-
if (
|
|
616
|
+
if ((tag2 === "img" || tag2 === "video" || tag2 === "audio") && typeof properties.src === "string") properties.src = hostAssetSrc(properties.src);
|
|
617
|
+
if (tag2 === "iframe") {
|
|
617
618
|
if (properties.sandbox === void 0 || properties.srcdoc === void 0) return [];
|
|
618
619
|
properties.sandbox = "allow-scripts";
|
|
619
620
|
}
|
|
620
|
-
if (
|
|
621
|
+
if (tag2 === "input") {
|
|
621
622
|
if (properties.type !== "checkbox") return [];
|
|
622
623
|
properties.disabled = true;
|
|
623
624
|
}
|
|
624
625
|
for (const key of ["id", "ariaDescribedBy"]) if (typeof properties[key] === "string") properties[key] = scopeId(properties[key]);
|
|
625
|
-
if (
|
|
626
|
-
if (
|
|
626
|
+
if (tag2 === "a" && typeof properties.href === "string" && properties.href.trim().startsWith("#")) properties.href = `#${scopeId(properties.href.trim().slice(1))}`;
|
|
627
|
+
if (tag2 === "blockquote") {
|
|
627
628
|
const callout = toCallout(children);
|
|
628
629
|
if (callout) return [callout];
|
|
629
630
|
}
|
|
630
|
-
const tagName =
|
|
631
|
-
return [{ type: "element", tagName, properties, children: VOID.has(
|
|
631
|
+
const tagName = tag2 === "h1" ? "h2" : tag2;
|
|
632
|
+
return [{ type: "element", tagName, properties, children: VOID.has(tag2) ? [] : children }];
|
|
632
633
|
}
|
|
633
634
|
function sanitizeHast(tree, title, description) {
|
|
634
635
|
const raw = isObject(tree) && tree.type === "root" && Array.isArray(tree.children) ? tree.children : [];
|
|
@@ -1267,7 +1268,8 @@ function articleJsonLd(article, origin, c, author) {
|
|
|
1267
1268
|
headline: pub.title,
|
|
1268
1269
|
...pub.description ? { description: pub.description } : {},
|
|
1269
1270
|
datePublished: pub.published_at,
|
|
1270
|
-
|
|
1271
|
+
// a save before the publish leaves updated_at earlier than published_at; dateModified before datePublished is invalid
|
|
1272
|
+
...pub.updated_at && !(Date.parse(pub.updated_at) < Date.parse(pub.published_at)) ? { dateModified: pub.updated_at } : {},
|
|
1271
1273
|
...author ? { author: { "@type": "Person", name: author } } : {},
|
|
1272
1274
|
inLanguage: pub.locale,
|
|
1273
1275
|
mainEntityOfPage: url(pub.canonical_path)
|
|
@@ -1887,15 +1889,19 @@ function hyleMetadata(options) {
|
|
|
1887
1889
|
};
|
|
1888
1890
|
}
|
|
1889
1891
|
if (result.kind !== "article") return {};
|
|
1890
|
-
const { publication: pub, alternates } = result;
|
|
1892
|
+
const { publication: pub, alternates, default_locale } = result;
|
|
1891
1893
|
const canonical = toHref(pub.canonical_path, pub.locale);
|
|
1894
|
+
const defaultAlternate = alternates.find((a) => a.locale === default_locale);
|
|
1895
|
+
const xDefault = defaultAlternate ? toHref(defaultAlternate.canonical_path, defaultAlternate.locale) : canonical;
|
|
1892
1896
|
const description = pub.description ?? void 0;
|
|
1897
|
+
const author = typeof result.frontmatter.author === "string" ? result.frontmatter.author : void 0;
|
|
1898
|
+
const modified = pub.updated_at && !(Date.parse(pub.updated_at) < Date.parse(pub.published_at)) ? pub.updated_at : void 0;
|
|
1893
1899
|
return {
|
|
1894
1900
|
title: pub.title,
|
|
1895
1901
|
...description ? { description } : {},
|
|
1896
1902
|
alternates: {
|
|
1897
1903
|
canonical,
|
|
1898
|
-
...alternates.length > 1 ? { languages: { ...Object.fromEntries(alternates.map((a) => [a.locale, toHref(a.canonical_path, a.locale)])), "x-default":
|
|
1904
|
+
...alternates.length > 1 ? { languages: { ...Object.fromEntries(alternates.map((a) => [a.locale, toHref(a.canonical_path, a.locale)])), "x-default": xDefault } } : {}
|
|
1899
1905
|
},
|
|
1900
1906
|
openGraph: {
|
|
1901
1907
|
type: "article",
|
|
@@ -1904,7 +1910,8 @@ function hyleMetadata(options) {
|
|
|
1904
1910
|
url: canonical,
|
|
1905
1911
|
locale: pub.locale,
|
|
1906
1912
|
publishedTime: pub.published_at,
|
|
1907
|
-
modifiedTime:
|
|
1913
|
+
...modified ? { modifiedTime: modified } : {},
|
|
1914
|
+
...author ? { authors: [author] } : {}
|
|
1908
1915
|
}
|
|
1909
1916
|
};
|
|
1910
1917
|
} catch (error) {
|
|
@@ -1914,6 +1921,48 @@ function hyleMetadata(options) {
|
|
|
1914
1921
|
};
|
|
1915
1922
|
}
|
|
1916
1923
|
|
|
1924
|
+
// src/next/feed.ts
|
|
1925
|
+
var import_navigation3 = require("next/navigation");
|
|
1926
|
+
var xml = (value) => value.replace(/[&<>"']/g, (c) => `&#${c.charCodeAt(0)};`);
|
|
1927
|
+
var tag = (name, value) => `<${name}>${xml(value)}</${name}>`;
|
|
1928
|
+
var response = (body, status, headers) => new Response(body, { status, ...headers ? { headers } : {} });
|
|
1929
|
+
async function hyleFeed(options) {
|
|
1930
|
+
const origin = options.siteOrigin;
|
|
1931
|
+
if (!origin || !BARE_HTTPS_ORIGIN.test(origin)) {
|
|
1932
|
+
console.error("hyle: hyleFeed needs `siteOrigin`, a bare https origin such as https://example.com");
|
|
1933
|
+
return response(null, 404);
|
|
1934
|
+
}
|
|
1935
|
+
const { path, locale, toHref } = routeContext(options, {});
|
|
1936
|
+
if (path === void 0) return response(null, 404);
|
|
1937
|
+
const url = (sitePath) => origin + encodeURI(toHref(sitePath));
|
|
1938
|
+
try {
|
|
1939
|
+
const result = await resolverFor(options)(path, locale, options.limit ?? 50);
|
|
1940
|
+
if (result.kind !== "list") return response(null, 503);
|
|
1941
|
+
const items = result.items.filter((item) => item.canonical_path.startsWith("/")).map((item) => {
|
|
1942
|
+
const link = url(item.canonical_path);
|
|
1943
|
+
const published = new Date(item.published_at);
|
|
1944
|
+
return `<item>${tag("title", item.title)}${tag("link", link)}<guid isPermaLink="true">${xml(link)}</guid>${Number.isNaN(published.getTime()) ? "" : tag("pubDate", published.toUTCString())}${item.description ? tag("description", item.description) : ""}</item>`;
|
|
1945
|
+
});
|
|
1946
|
+
const channel = [
|
|
1947
|
+
tag("title", options.list?.title || result.section.title),
|
|
1948
|
+
tag("link", url(path)),
|
|
1949
|
+
tag("description", options.list?.description ?? ""),
|
|
1950
|
+
locale ? tag("language", locale) : "",
|
|
1951
|
+
`<atom:link href="${xml(origin + encodeURI(options.feedPath ?? "/feed.xml"))}" rel="self" type="application/rss+xml"/>`,
|
|
1952
|
+
...items
|
|
1953
|
+
].join("");
|
|
1954
|
+
return response(
|
|
1955
|
+
`<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel>${channel}</channel></rss>`,
|
|
1956
|
+
200,
|
|
1957
|
+
{ "content-type": "application/rss+xml; charset=utf-8" }
|
|
1958
|
+
);
|
|
1959
|
+
} catch (error) {
|
|
1960
|
+
(0, import_navigation3.unstable_rethrow)(error);
|
|
1961
|
+
console.error(`hyle: ${error instanceof Error ? error.name : "UnknownError"}`);
|
|
1962
|
+
return response(null, 503);
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
|
|
1917
1966
|
// src/next/revalidate.ts
|
|
1918
1967
|
var import_cache = require("next/cache");
|
|
1919
1968
|
var isSwitchedOff = (value) => ["0", "false"].includes(value?.trim().toLowerCase() ?? "");
|
|
@@ -1928,7 +1977,7 @@ function createRevalidateRoute(options) {
|
|
|
1928
1977
|
if (!workspaceId || secrets.length === 0) return new Response(null, { status: 503 });
|
|
1929
1978
|
const key = `${workspaceId}\0${secrets.join("\0")}`;
|
|
1930
1979
|
if (cached?.key !== key) {
|
|
1931
|
-
cached = { key, route: createRevalidationCallbackRoute({ workspaceId, secrets, revalidateTag: (
|
|
1980
|
+
cached = { key, route: createRevalidationCallbackRoute({ workspaceId, secrets, revalidateTag: (tag2) => (0, import_cache.revalidateTag)(tag2, { expire: 0 }) }) };
|
|
1932
1981
|
}
|
|
1933
1982
|
return cached.route.POST(req);
|
|
1934
1983
|
}
|
|
@@ -1936,7 +1985,7 @@ function createRevalidateRoute(options) {
|
|
|
1936
1985
|
}
|
|
1937
1986
|
|
|
1938
1987
|
// src/next/root.ts
|
|
1939
|
-
var
|
|
1988
|
+
var import_navigation4 = require("next/navigation");
|
|
1940
1989
|
|
|
1941
1990
|
// src/next/mount-match.ts
|
|
1942
1991
|
function activeMounts(mounts) {
|
|
@@ -2030,7 +2079,7 @@ function hyleRootPage(options) {
|
|
|
2030
2079
|
const route = createRouter(options, hylePage);
|
|
2031
2080
|
return async function HyleRootPage({ params, searchParams }) {
|
|
2032
2081
|
const hit = await route(await params ?? {});
|
|
2033
|
-
if (!hit) (0,
|
|
2082
|
+
if (!hit) (0, import_navigation4.notFound)();
|
|
2034
2083
|
return hit.handler({ params: Promise.resolve(hit.params), ...searchParams ? { searchParams } : {} });
|
|
2035
2084
|
};
|
|
2036
2085
|
}
|
|
@@ -2129,7 +2178,7 @@ function createAssetRoute(options) {
|
|
|
2129
2178
|
}
|
|
2130
2179
|
|
|
2131
2180
|
// src/next/embed.tsx
|
|
2132
|
-
var
|
|
2181
|
+
var import_navigation5 = require("next/navigation");
|
|
2133
2182
|
|
|
2134
2183
|
// src/next/engage.ts
|
|
2135
2184
|
var ENGAGE_CSRF_HEADER = "x-hyle-engage";
|
|
@@ -2473,7 +2522,7 @@ async function HyleComments({ options, path, revalidate = 60, interactive }) {
|
|
|
2473
2522
|
const date = Date.parse(res.headers.get("date") ?? "");
|
|
2474
2523
|
fetchedAt = Number.isFinite(date) ? date : void 0;
|
|
2475
2524
|
} catch (error) {
|
|
2476
|
-
(0,
|
|
2525
|
+
(0, import_navigation5.unstable_rethrow)(error);
|
|
2477
2526
|
console.error(`hyle: ${error instanceof Error ? error.name : "UnknownError"}`);
|
|
2478
2527
|
return null;
|
|
2479
2528
|
}
|
|
@@ -2494,6 +2543,7 @@ async function HyleComments({ options, path, revalidate = 60, interactive }) {
|
|
|
2494
2543
|
createEngagementRoute,
|
|
2495
2544
|
createRevalidateRoute,
|
|
2496
2545
|
fetchResolver,
|
|
2546
|
+
hyleFeed,
|
|
2497
2547
|
hyleMetadata,
|
|
2498
2548
|
hylePage,
|
|
2499
2549
|
hyleRootMetadata,
|
package/dist/next.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
|
-
import { H as HyleComponents, a as HyleSlots, E as EngagementConfig, b as EmbedHeading } from './embed-
|
|
3
|
-
export { c as HyleCommentsFallback } from './embed-
|
|
4
|
-
import { F as FetchResolverOptions, H as HyleResolver } from './resolve-
|
|
5
|
-
export { f as fetchResolver, w as workspaceTags } from './resolve-
|
|
2
|
+
import { H as HyleComponents, a as HyleSlots, E as EngagementConfig, b as EmbedHeading } from './embed-jCaSI31t.cjs';
|
|
3
|
+
export { c as HyleCommentsFallback } from './embed-jCaSI31t.cjs';
|
|
4
|
+
import { F as FetchResolverOptions, H as HyleResolver } from './resolve-f6IJ6SL9.cjs';
|
|
5
|
+
export { f as fetchResolver, w as workspaceTags } from './resolve-f6IJ6SL9.cjs';
|
|
6
6
|
import { MetadataRoute, Metadata } from 'next';
|
|
7
7
|
import { a as RevalidationCallbackRoute } from './revalidation-callback-D7Ms_Puz.cjs';
|
|
8
|
-
import './types-
|
|
8
|
+
import './types-5D6ZD0Wi.cjs';
|
|
9
9
|
|
|
10
10
|
type RouteParams = Record<string, string | string[] | undefined>;
|
|
11
11
|
interface CommonOptions {
|
|
@@ -129,7 +129,7 @@ declare function hyleSitemap(options: HyleSitemapOptions): Promise<MetadataRoute
|
|
|
129
129
|
/**
|
|
130
130
|
* `export const generateMetadata = hyleMetadata({ ... })` with the same options as `hylePage`. Title, description, a canonical
|
|
131
131
|
* URL in the page's own locale (so a fallback copy under another locale prefix points at the original), hreflang alternates
|
|
132
|
-
* from the response's `alternates` plus `x-default
|
|
132
|
+
* from the response's `alternates` plus `x-default` (the workspace default locale's page, else the page's own), and Open Graph. A list page canonicals to itself; with `paginate` a cursor
|
|
133
133
|
* page canonicals to its own `?cursor=` URL (never to the first page) and its title gets an "Older posts" suffix.
|
|
134
134
|
* Paths are relative: set `metadataBase` in the host's root layout.
|
|
135
135
|
* Redirects, 404s and a switched-off read surface produce no metadata; `hylePage` handles those. A 4xx rejection of the request
|
|
@@ -138,6 +138,20 @@ declare function hyleSitemap(options: HyleSitemapOptions): Promise<MetadataRoute
|
|
|
138
138
|
*/
|
|
139
139
|
declare function hyleMetadata(options: HyleNextOptions): (props: PageProps) => Promise<Metadata>;
|
|
140
140
|
|
|
141
|
+
type HyleFeedOptions = HyleNextOptions & {
|
|
142
|
+
/** Items in the feed (the server maximum is 100). Default 50. */
|
|
143
|
+
readonly limit?: number;
|
|
144
|
+
/** Where the host mounts the feed route, for `<atom:link rel="self">`. Default "/feed.xml". */
|
|
145
|
+
readonly feedPath?: string;
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* `export const GET = () => hyleFeed({ ...sameOptionsAsHylePage, siteOrigin })` in `app/feed.xml/route.ts`: an RSS 2.0 feed of the
|
|
149
|
+
* newest articles of the mount's default section, read through the same resolver (cache and tags) as `hylePage`. Feeds need
|
|
150
|
+
* absolute URLs, so a missing or malformed `siteOrigin` logs once and answers 404. A hyle failure answers 503 (never throws);
|
|
151
|
+
* Next control flow propagates. Items whose `canonical_path` is not a site path are dropped.
|
|
152
|
+
*/
|
|
153
|
+
declare function hyleFeed(options: HyleFeedOptions): Promise<Response>;
|
|
154
|
+
|
|
141
155
|
interface RevalidateRouteOptions {
|
|
142
156
|
/** This deployment's workspace id (HYLE_WORKSPACE_ID); a callback for another workspace is ignored. */
|
|
143
157
|
readonly workspaceId: string | undefined;
|
|
@@ -370,4 +384,4 @@ declare const ENGAGE_CSRF_HEADER = "x-hyle-engage";
|
|
|
370
384
|
*/
|
|
371
385
|
declare function createEngagementRoute(options: EngagementRouteOptions): EngagementRoute;
|
|
372
386
|
|
|
373
|
-
export { type AssetRoute, type AssetRouteOptions, ENGAGE_CSRF_HEADER, type EngageReader, type EngagementRoute, type EngagementRouteOptions, FetchResolverOptions, HyleArticle, type HyleArticleProps, HyleComments, type HyleCommentsProps, HyleList, type HyleListProps, type HyleNextOptions, HyleResolver, type HyleRootConfig, type HyleRootSitemapOptions, type HyleSitemapOptions, MOUNTS_MAX_STALE_MS, type PageProps, type RevalidateRouteOptions, type RouteParams, createAssetRoute, createEngagementRoute, createRevalidateRoute, hyleMetadata, hylePage, hyleRootMetadata, hyleRootPage, hyleRootSitemap, hyleSitemap };
|
|
387
|
+
export { type AssetRoute, type AssetRouteOptions, ENGAGE_CSRF_HEADER, type EngageReader, type EngagementRoute, type EngagementRouteOptions, FetchResolverOptions, HyleArticle, type HyleArticleProps, HyleComments, type HyleCommentsProps, type HyleFeedOptions, HyleList, type HyleListProps, type HyleNextOptions, HyleResolver, type HyleRootConfig, type HyleRootSitemapOptions, type HyleSitemapOptions, MOUNTS_MAX_STALE_MS, type PageProps, type RevalidateRouteOptions, type RouteParams, createAssetRoute, createEngagementRoute, createRevalidateRoute, hyleFeed, hyleMetadata, hylePage, hyleRootMetadata, hyleRootPage, hyleRootSitemap, hyleSitemap };
|
package/dist/next.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
|
-
import { H as HyleComponents, a as HyleSlots, E as EngagementConfig, b as EmbedHeading } from './embed-
|
|
3
|
-
export { c as HyleCommentsFallback } from './embed-
|
|
4
|
-
import { F as FetchResolverOptions, H as HyleResolver } from './resolve-
|
|
5
|
-
export { f as fetchResolver, w as workspaceTags } from './resolve-
|
|
2
|
+
import { H as HyleComponents, a as HyleSlots, E as EngagementConfig, b as EmbedHeading } from './embed-DL5QIZRJ.js';
|
|
3
|
+
export { c as HyleCommentsFallback } from './embed-DL5QIZRJ.js';
|
|
4
|
+
import { F as FetchResolverOptions, H as HyleResolver } from './resolve-DvmuBlpO.js';
|
|
5
|
+
export { f as fetchResolver, w as workspaceTags } from './resolve-DvmuBlpO.js';
|
|
6
6
|
import { MetadataRoute, Metadata } from 'next';
|
|
7
7
|
import { a as RevalidationCallbackRoute } from './revalidation-callback-D7Ms_Puz.js';
|
|
8
|
-
import './types-
|
|
8
|
+
import './types-5D6ZD0Wi.js';
|
|
9
9
|
|
|
10
10
|
type RouteParams = Record<string, string | string[] | undefined>;
|
|
11
11
|
interface CommonOptions {
|
|
@@ -129,7 +129,7 @@ declare function hyleSitemap(options: HyleSitemapOptions): Promise<MetadataRoute
|
|
|
129
129
|
/**
|
|
130
130
|
* `export const generateMetadata = hyleMetadata({ ... })` with the same options as `hylePage`. Title, description, a canonical
|
|
131
131
|
* URL in the page's own locale (so a fallback copy under another locale prefix points at the original), hreflang alternates
|
|
132
|
-
* from the response's `alternates` plus `x-default
|
|
132
|
+
* from the response's `alternates` plus `x-default` (the workspace default locale's page, else the page's own), and Open Graph. A list page canonicals to itself; with `paginate` a cursor
|
|
133
133
|
* page canonicals to its own `?cursor=` URL (never to the first page) and its title gets an "Older posts" suffix.
|
|
134
134
|
* Paths are relative: set `metadataBase` in the host's root layout.
|
|
135
135
|
* Redirects, 404s and a switched-off read surface produce no metadata; `hylePage` handles those. A 4xx rejection of the request
|
|
@@ -138,6 +138,20 @@ declare function hyleSitemap(options: HyleSitemapOptions): Promise<MetadataRoute
|
|
|
138
138
|
*/
|
|
139
139
|
declare function hyleMetadata(options: HyleNextOptions): (props: PageProps) => Promise<Metadata>;
|
|
140
140
|
|
|
141
|
+
type HyleFeedOptions = HyleNextOptions & {
|
|
142
|
+
/** Items in the feed (the server maximum is 100). Default 50. */
|
|
143
|
+
readonly limit?: number;
|
|
144
|
+
/** Where the host mounts the feed route, for `<atom:link rel="self">`. Default "/feed.xml". */
|
|
145
|
+
readonly feedPath?: string;
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* `export const GET = () => hyleFeed({ ...sameOptionsAsHylePage, siteOrigin })` in `app/feed.xml/route.ts`: an RSS 2.0 feed of the
|
|
149
|
+
* newest articles of the mount's default section, read through the same resolver (cache and tags) as `hylePage`. Feeds need
|
|
150
|
+
* absolute URLs, so a missing or malformed `siteOrigin` logs once and answers 404. A hyle failure answers 503 (never throws);
|
|
151
|
+
* Next control flow propagates. Items whose `canonical_path` is not a site path are dropped.
|
|
152
|
+
*/
|
|
153
|
+
declare function hyleFeed(options: HyleFeedOptions): Promise<Response>;
|
|
154
|
+
|
|
141
155
|
interface RevalidateRouteOptions {
|
|
142
156
|
/** This deployment's workspace id (HYLE_WORKSPACE_ID); a callback for another workspace is ignored. */
|
|
143
157
|
readonly workspaceId: string | undefined;
|
|
@@ -370,4 +384,4 @@ declare const ENGAGE_CSRF_HEADER = "x-hyle-engage";
|
|
|
370
384
|
*/
|
|
371
385
|
declare function createEngagementRoute(options: EngagementRouteOptions): EngagementRoute;
|
|
372
386
|
|
|
373
|
-
export { type AssetRoute, type AssetRouteOptions, ENGAGE_CSRF_HEADER, type EngageReader, type EngagementRoute, type EngagementRouteOptions, FetchResolverOptions, HyleArticle, type HyleArticleProps, HyleComments, type HyleCommentsProps, HyleList, type HyleListProps, type HyleNextOptions, HyleResolver, type HyleRootConfig, type HyleRootSitemapOptions, type HyleSitemapOptions, MOUNTS_MAX_STALE_MS, type PageProps, type RevalidateRouteOptions, type RouteParams, createAssetRoute, createEngagementRoute, createRevalidateRoute, hyleMetadata, hylePage, hyleRootMetadata, hyleRootPage, hyleRootSitemap, hyleSitemap };
|
|
387
|
+
export { type AssetRoute, type AssetRouteOptions, ENGAGE_CSRF_HEADER, type EngageReader, type EngagementRoute, type EngagementRouteOptions, FetchResolverOptions, HyleArticle, type HyleArticleProps, HyleComments, type HyleCommentsProps, type HyleFeedOptions, HyleList, type HyleListProps, type HyleNextOptions, HyleResolver, type HyleRootConfig, type HyleRootSitemapOptions, type HyleSitemapOptions, MOUNTS_MAX_STALE_MS, type PageProps, type RevalidateRouteOptions, type RouteParams, createAssetRoute, createEngagementRoute, createRevalidateRoute, hyleFeed, hyleMetadata, hylePage, hyleRootMetadata, hyleRootPage, hyleRootSitemap, hyleSitemap };
|
package/dist/next.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ArticlePage,
|
|
3
|
+
BARE_HTTPS_ORIGIN,
|
|
3
4
|
Comments,
|
|
4
5
|
DocsPage,
|
|
5
6
|
HyleArticleView,
|
|
@@ -9,7 +10,7 @@ import {
|
|
|
9
10
|
ListPage,
|
|
10
11
|
parseListing,
|
|
11
12
|
stringsFor
|
|
12
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-ZQFYH4FX.js";
|
|
13
14
|
import {
|
|
14
15
|
DEFAULT_REVALIDATE,
|
|
15
16
|
fetchResolver,
|
|
@@ -182,15 +183,19 @@ function hyleMetadata(options) {
|
|
|
182
183
|
};
|
|
183
184
|
}
|
|
184
185
|
if (result.kind !== "article") return {};
|
|
185
|
-
const { publication: pub, alternates } = result;
|
|
186
|
+
const { publication: pub, alternates, default_locale } = result;
|
|
186
187
|
const canonical = toHref(pub.canonical_path, pub.locale);
|
|
188
|
+
const defaultAlternate = alternates.find((a) => a.locale === default_locale);
|
|
189
|
+
const xDefault = defaultAlternate ? toHref(defaultAlternate.canonical_path, defaultAlternate.locale) : canonical;
|
|
187
190
|
const description = pub.description ?? void 0;
|
|
191
|
+
const author = typeof result.frontmatter.author === "string" ? result.frontmatter.author : void 0;
|
|
192
|
+
const modified = pub.updated_at && !(Date.parse(pub.updated_at) < Date.parse(pub.published_at)) ? pub.updated_at : void 0;
|
|
188
193
|
return {
|
|
189
194
|
title: pub.title,
|
|
190
195
|
...description ? { description } : {},
|
|
191
196
|
alternates: {
|
|
192
197
|
canonical,
|
|
193
|
-
...alternates.length > 1 ? { languages: { ...Object.fromEntries(alternates.map((a) => [a.locale, toHref(a.canonical_path, a.locale)])), "x-default":
|
|
198
|
+
...alternates.length > 1 ? { languages: { ...Object.fromEntries(alternates.map((a) => [a.locale, toHref(a.canonical_path, a.locale)])), "x-default": xDefault } } : {}
|
|
194
199
|
},
|
|
195
200
|
openGraph: {
|
|
196
201
|
type: "article",
|
|
@@ -199,7 +204,8 @@ function hyleMetadata(options) {
|
|
|
199
204
|
url: canonical,
|
|
200
205
|
locale: pub.locale,
|
|
201
206
|
publishedTime: pub.published_at,
|
|
202
|
-
modifiedTime:
|
|
207
|
+
...modified ? { modifiedTime: modified } : {},
|
|
208
|
+
...author ? { authors: [author] } : {}
|
|
203
209
|
}
|
|
204
210
|
};
|
|
205
211
|
} catch (error) {
|
|
@@ -209,6 +215,48 @@ function hyleMetadata(options) {
|
|
|
209
215
|
};
|
|
210
216
|
}
|
|
211
217
|
|
|
218
|
+
// src/next/feed.ts
|
|
219
|
+
import { unstable_rethrow as unstable_rethrow2 } from "next/navigation";
|
|
220
|
+
var xml = (value) => value.replace(/[&<>"']/g, (c) => `&#${c.charCodeAt(0)};`);
|
|
221
|
+
var tag = (name, value) => `<${name}>${xml(value)}</${name}>`;
|
|
222
|
+
var response = (body, status, headers) => new Response(body, { status, ...headers ? { headers } : {} });
|
|
223
|
+
async function hyleFeed(options) {
|
|
224
|
+
const origin = options.siteOrigin;
|
|
225
|
+
if (!origin || !BARE_HTTPS_ORIGIN.test(origin)) {
|
|
226
|
+
console.error("hyle: hyleFeed needs `siteOrigin`, a bare https origin such as https://example.com");
|
|
227
|
+
return response(null, 404);
|
|
228
|
+
}
|
|
229
|
+
const { path, locale, toHref } = routeContext(options, {});
|
|
230
|
+
if (path === void 0) return response(null, 404);
|
|
231
|
+
const url = (sitePath) => origin + encodeURI(toHref(sitePath));
|
|
232
|
+
try {
|
|
233
|
+
const result = await resolverFor(options)(path, locale, options.limit ?? 50);
|
|
234
|
+
if (result.kind !== "list") return response(null, 503);
|
|
235
|
+
const items = result.items.filter((item) => item.canonical_path.startsWith("/")).map((item) => {
|
|
236
|
+
const link = url(item.canonical_path);
|
|
237
|
+
const published = new Date(item.published_at);
|
|
238
|
+
return `<item>${tag("title", item.title)}${tag("link", link)}<guid isPermaLink="true">${xml(link)}</guid>${Number.isNaN(published.getTime()) ? "" : tag("pubDate", published.toUTCString())}${item.description ? tag("description", item.description) : ""}</item>`;
|
|
239
|
+
});
|
|
240
|
+
const channel = [
|
|
241
|
+
tag("title", options.list?.title || result.section.title),
|
|
242
|
+
tag("link", url(path)),
|
|
243
|
+
tag("description", options.list?.description ?? ""),
|
|
244
|
+
locale ? tag("language", locale) : "",
|
|
245
|
+
`<atom:link href="${xml(origin + encodeURI(options.feedPath ?? "/feed.xml"))}" rel="self" type="application/rss+xml"/>`,
|
|
246
|
+
...items
|
|
247
|
+
].join("");
|
|
248
|
+
return response(
|
|
249
|
+
`<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel>${channel}</channel></rss>`,
|
|
250
|
+
200,
|
|
251
|
+
{ "content-type": "application/rss+xml; charset=utf-8" }
|
|
252
|
+
);
|
|
253
|
+
} catch (error) {
|
|
254
|
+
unstable_rethrow2(error);
|
|
255
|
+
console.error(`hyle: ${error instanceof Error ? error.name : "UnknownError"}`);
|
|
256
|
+
return response(null, 503);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
212
260
|
// src/next/revalidate.ts
|
|
213
261
|
import { revalidateTag } from "next/cache";
|
|
214
262
|
var isSwitchedOff = (value) => ["0", "false"].includes(value?.trim().toLowerCase() ?? "");
|
|
@@ -223,7 +271,7 @@ function createRevalidateRoute(options) {
|
|
|
223
271
|
if (!workspaceId || secrets.length === 0) return new Response(null, { status: 503 });
|
|
224
272
|
const key = `${workspaceId}\0${secrets.join("\0")}`;
|
|
225
273
|
if (cached?.key !== key) {
|
|
226
|
-
cached = { key, route: createRevalidationCallbackRoute({ workspaceId, secrets, revalidateTag: (
|
|
274
|
+
cached = { key, route: createRevalidationCallbackRoute({ workspaceId, secrets, revalidateTag: (tag2) => revalidateTag(tag2, { expire: 0 }) }) };
|
|
227
275
|
}
|
|
228
276
|
return cached.route.POST(req);
|
|
229
277
|
}
|
|
@@ -424,7 +472,7 @@ function createAssetRoute(options) {
|
|
|
424
472
|
}
|
|
425
473
|
|
|
426
474
|
// src/next/embed.tsx
|
|
427
|
-
import { unstable_rethrow as
|
|
475
|
+
import { unstable_rethrow as unstable_rethrow3 } from "next/navigation";
|
|
428
476
|
|
|
429
477
|
// src/next/engage.ts
|
|
430
478
|
var ENGAGE_CSRF_HEADER = "x-hyle-engage";
|
|
@@ -768,7 +816,7 @@ async function HyleComments({ options, path, revalidate = 60, interactive }) {
|
|
|
768
816
|
const date = Date.parse(res.headers.get("date") ?? "");
|
|
769
817
|
fetchedAt = Number.isFinite(date) ? date : void 0;
|
|
770
818
|
} catch (error) {
|
|
771
|
-
|
|
819
|
+
unstable_rethrow3(error);
|
|
772
820
|
console.error(`hyle: ${error instanceof Error ? error.name : "UnknownError"}`);
|
|
773
821
|
return null;
|
|
774
822
|
}
|
|
@@ -788,6 +836,7 @@ export {
|
|
|
788
836
|
createEngagementRoute,
|
|
789
837
|
createRevalidateRoute,
|
|
790
838
|
fetchResolver,
|
|
839
|
+
hyleFeed,
|
|
791
840
|
hyleMetadata,
|
|
792
841
|
hylePage,
|
|
793
842
|
hyleRootMetadata,
|
package/dist/react.cjs
CHANGED
|
@@ -917,7 +917,8 @@ function articleJsonLd(article, origin, c, author) {
|
|
|
917
917
|
headline: pub.title,
|
|
918
918
|
...pub.description ? { description: pub.description } : {},
|
|
919
919
|
datePublished: pub.published_at,
|
|
920
|
-
|
|
920
|
+
// a save before the publish leaves updated_at earlier than published_at; dateModified before datePublished is invalid
|
|
921
|
+
...pub.updated_at && !(Date.parse(pub.updated_at) < Date.parse(pub.published_at)) ? { dateModified: pub.updated_at } : {},
|
|
921
922
|
...author ? { author: { "@type": "Person", name: author } } : {},
|
|
922
923
|
inLanguage: pub.locale,
|
|
923
924
|
mainEntityOfPage: url(pub.canonical_path)
|
package/dist/react.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactElement } from 'react';
|
|
3
|
-
import { H as HyleComponents, P as PageBaseProps, E as EngagementConfig } from './embed-
|
|
4
|
-
export { C as CalloutKind, d as CalloutProps, e as CodeBlockProps, b as EmbedHeading, f as HyleArticleView, g as HyleArticleViewProps, h as HyleListView, i as HyleListViewProps, a as HyleSlots, I as ImageProps, L as LinkProps, j as ListItemProps, M as MermaidProps } from './embed-
|
|
3
|
+
import { H as HyleComponents, P as PageBaseProps, E as EngagementConfig } from './embed-jCaSI31t.cjs';
|
|
4
|
+
export { C as CalloutKind, d as CalloutProps, e as CodeBlockProps, b as EmbedHeading, f as HyleArticleView, g as HyleArticleViewProps, h as HyleListView, i as HyleListViewProps, a as HyleSlots, I as ImageProps, L as LinkProps, j as ListItemProps, M as MermaidProps } from './embed-jCaSI31t.cjs';
|
|
5
5
|
import { Root } from 'hast';
|
|
6
|
-
import { h as ResolvedArticle, j as ResolvedList, c as EngageListing } from './types-
|
|
6
|
+
import { h as ResolvedArticle, j as ResolvedList, c as EngageListing } from './types-5D6ZD0Wi.cjs';
|
|
7
7
|
|
|
8
8
|
interface HastContentProps {
|
|
9
9
|
/** `content.tree` from an article result. Anything that is not a hast root renders nothing. */
|
package/dist/react.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactElement } from 'react';
|
|
3
|
-
import { H as HyleComponents, P as PageBaseProps, E as EngagementConfig } from './embed-
|
|
4
|
-
export { C as CalloutKind, d as CalloutProps, e as CodeBlockProps, b as EmbedHeading, f as HyleArticleView, g as HyleArticleViewProps, h as HyleListView, i as HyleListViewProps, a as HyleSlots, I as ImageProps, L as LinkProps, j as ListItemProps, M as MermaidProps } from './embed-
|
|
3
|
+
import { H as HyleComponents, P as PageBaseProps, E as EngagementConfig } from './embed-DL5QIZRJ.js';
|
|
4
|
+
export { C as CalloutKind, d as CalloutProps, e as CodeBlockProps, b as EmbedHeading, f as HyleArticleView, g as HyleArticleViewProps, h as HyleListView, i as HyleListViewProps, a as HyleSlots, I as ImageProps, L as LinkProps, j as ListItemProps, M as MermaidProps } from './embed-DL5QIZRJ.js';
|
|
5
5
|
import { Root } from 'hast';
|
|
6
|
-
import { h as ResolvedArticle, j as ResolvedList, c as EngageListing } from './types-
|
|
6
|
+
import { h as ResolvedArticle, j as ResolvedList, c as EngageListing } from './types-5D6ZD0Wi.js';
|
|
7
7
|
|
|
8
8
|
interface HastContentProps {
|
|
9
9
|
/** `content.tree` from an article result. Anything that is not a hast root renders nothing. */
|
package/dist/react.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as Resolved } from './types-
|
|
1
|
+
import { R as Resolved } from './types-5D6ZD0Wi.js';
|
|
2
2
|
|
|
3
3
|
/** Resolves a site path to a result. The two built-in strategies are `fetchResolver` (default) and `cachedResolver` (`@tdacorp/hyle-sdk/next/use-cache`). */
|
|
4
4
|
type HyleResolver = (path: string, locale: string | undefined, limit?: number, cursor?: string, nav?: "tree") => Promise<Resolved>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as Resolved } from './types-
|
|
1
|
+
import { R as Resolved } from './types-5D6ZD0Wi.cjs';
|
|
2
2
|
|
|
3
3
|
/** Resolves a site path to a result. The two built-in strategies are `fetchResolver` (default) and `cachedResolver` (`@tdacorp/hyle-sdk/next/use-cache`). */
|
|
4
4
|
type HyleResolver = (path: string, locale: string | undefined, limit?: number, cursor?: string, nav?: "tree") => Promise<Resolved>;
|
|
@@ -74,6 +74,8 @@ interface ResolvedArticle {
|
|
|
74
74
|
/** Present only when requested with `nav: "tree"` (the docs layout does); absent from every other response. */
|
|
75
75
|
readonly nav?: NavTree;
|
|
76
76
|
readonly alternates: readonly Alternate[];
|
|
77
|
+
/** The workspace default locale; absent from an older server. */
|
|
78
|
+
readonly default_locale?: string;
|
|
77
79
|
readonly fallback?: Fallback;
|
|
78
80
|
readonly cache: CacheInfo;
|
|
79
81
|
}
|
|
@@ -74,6 +74,8 @@ interface ResolvedArticle {
|
|
|
74
74
|
/** Present only when requested with `nav: "tree"` (the docs layout does); absent from every other response. */
|
|
75
75
|
readonly nav?: NavTree;
|
|
76
76
|
readonly alternates: readonly Alternate[];
|
|
77
|
+
/** The workspace default locale; absent from an older server. */
|
|
78
|
+
readonly default_locale?: string;
|
|
77
79
|
readonly fallback?: Fallback;
|
|
78
80
|
readonly cache: CacheInfo;
|
|
79
81
|
}
|
package/dist/use-cache.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { H as HyleResolver } from './resolve-
|
|
2
|
-
import './types-
|
|
1
|
+
import { H as HyleResolver } from './resolve-f6IJ6SL9.cjs';
|
|
2
|
+
import './types-5D6ZD0Wi.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The exact caching strategy: a `'use cache'` function that fetches, then tags its own entry with the tags the response
|
package/dist/use-cache.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { H as HyleResolver } from './resolve-
|
|
2
|
-
import './types-
|
|
1
|
+
import { H as HyleResolver } from './resolve-DvmuBlpO.js';
|
|
2
|
+
import './types-5D6ZD0Wi.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The exact caching strategy: a `'use cache'` function that fetches, then tags its own entry with the tags the response
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tdacorp/hyle-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "hyle SDK: a typed client for hyle's resolve endpoint, a hast renderer for React, and a Next.js catch-all page with tag-based revalidation.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|