@tdacorp/hyle-sdk 0.5.0 → 0.9.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 +49 -8
- package/dist/check-routes-bin.js +168 -19
- package/dist/{chunk-4OB77ZOD.js → chunk-54JF4E53.js} +93 -11
- package/dist/chunk-67IOIAVW.js +35 -0
- package/dist/{chunk-SO6H2UGL.js → chunk-6LW33475.js} +110 -66
- package/dist/{chunk-OW6S7IZX.js → chunk-XKR74Y5G.js} +3 -2
- package/dist/docs-enhance.cjs +97 -0
- package/dist/docs-enhance.d.cts +16 -0
- package/dist/docs-enhance.d.ts +16 -0
- package/dist/docs-enhance.js +73 -0
- package/dist/index.cjs +97 -11
- package/dist/index.d.cts +61 -7
- package/dist/index.d.ts +61 -7
- package/dist/index.js +6 -1
- package/dist/next.cjs +211 -56
- package/dist/next.d.cts +47 -5
- package/dist/next.d.ts +47 -5
- package/dist/next.js +84 -5
- package/dist/react.cjs +118 -65
- package/dist/react.d.cts +35 -32
- package/dist/react.d.ts +35 -32
- package/dist/react.js +2 -1
- package/dist/{resolve-1rQntRBh.d.ts → resolve-D2rnnho9.d.cts} +2 -2
- package/dist/{resolve-36-Ng1H0.d.cts → resolve-Dpb6Orsj.d.ts} +2 -2
- package/dist/styles.css +32 -21
- package/dist/{types-DnPzhrFx.d.cts → types-BPPZrYOZ.d.cts} +1 -1
- package/dist/{types-BoyBWF2F.d.ts → types-C1eCQ2As.d.ts} +1 -1
- package/dist/{types-CwBCPh6K.d.cts → types-CHxH5E0S.d.cts} +15 -1
- package/dist/{types-CwBCPh6K.d.ts → types-CHxH5E0S.d.ts} +15 -1
- package/dist/use-cache.cjs +26 -7
- package/dist/use-cache.d.cts +2 -2
- package/dist/use-cache.d.ts +2 -2
- package/dist/use-cache.js +6 -5
- package/package.json +1 -1
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import {
|
|
2
|
+
hostAssetHtml,
|
|
3
|
+
hostAssetSrc
|
|
4
|
+
} from "./chunk-67IOIAVW.js";
|
|
5
|
+
|
|
1
6
|
// src/react/content.tsx
|
|
2
7
|
import { toJsxRuntime } from "hast-util-to-jsx-runtime";
|
|
3
8
|
import { Children, Fragment as Fragment2, isValidElement } from "react";
|
|
@@ -33,7 +38,8 @@ var SHAPES = {
|
|
|
33
38
|
] }),
|
|
34
39
|
chev: /* @__PURE__ */ jsx("path", { d: "m6 3.5 4.5 4.5L6 12.5" }),
|
|
35
40
|
"chev-down": /* @__PURE__ */ jsx("path", { d: "m3.5 6 4.5 4.5L12.5 6" }),
|
|
36
|
-
"chev-left": /* @__PURE__ */ jsx("path", { d: "M10 3.5 5.5 8 10 12.5" })
|
|
41
|
+
"chev-left": /* @__PURE__ */ jsx("path", { d: "M10 3.5 5.5 8 10 12.5" }),
|
|
42
|
+
x: /* @__PURE__ */ jsx("path", { d: "m4 4 8 8M12 4l-8 8" })
|
|
37
43
|
};
|
|
38
44
|
function Icon({ name, className }) {
|
|
39
45
|
return /* @__PURE__ */ jsx("svg", { className: className ? `hyle-ic ${className}` : "hyle-ic", viewBox: "0 0 16 16", "aria-hidden": "true", children: SHAPES[name] });
|
|
@@ -194,6 +200,7 @@ function clean(node, depth, ctx2, budget) {
|
|
|
194
200
|
if (Object.hasOwn(rules, key) && rules[key](value, inner)) properties[key] = value;
|
|
195
201
|
}
|
|
196
202
|
}
|
|
203
|
+
if ((tag === "img" || tag === "video" || tag === "audio") && typeof properties.src === "string") properties.src = hostAssetSrc(properties.src);
|
|
197
204
|
if (tag === "iframe") {
|
|
198
205
|
if (properties.sandbox === void 0 || properties.srcdoc === void 0) return [];
|
|
199
206
|
properties.sandbox = "allow-scripts";
|
|
@@ -340,6 +347,8 @@ var en = {
|
|
|
340
347
|
emptyBody: "Documents published to this section will appear here, newest first.",
|
|
341
348
|
docs: "Documentation",
|
|
342
349
|
menu: "Menu",
|
|
350
|
+
closeMenu: "Close menu",
|
|
351
|
+
updated: "Last updated",
|
|
343
352
|
nfKind: "404 \xB7 Not found",
|
|
344
353
|
nfTitle: "This page does not exist",
|
|
345
354
|
nfBody: "The address may be mistyped, or the document may have been unpublished or moved.",
|
|
@@ -381,6 +390,8 @@ var fr = {
|
|
|
381
390
|
emptyBody: "Les documents publi\xE9s dans cette section appara\xEEtront ici, du plus r\xE9cent au plus ancien.",
|
|
382
391
|
docs: "Documentation",
|
|
383
392
|
menu: "Menu",
|
|
393
|
+
closeMenu: "Fermer le menu",
|
|
394
|
+
updated: "Derni\xE8re mise \xE0 jour",
|
|
384
395
|
nfKind: "404 \xB7 Introuvable",
|
|
385
396
|
nfTitle: "Cette page n'existe pas",
|
|
386
397
|
nfBody: "L'adresse est peut-\xEAtre mal saisie, ou le document a \xE9t\xE9 d\xE9publi\xE9 ou d\xE9plac\xE9.",
|
|
@@ -422,6 +433,8 @@ var es = {
|
|
|
422
433
|
emptyBody: "Los documentos publicados en esta secci\xF3n aparecer\xE1n aqu\xED, del m\xE1s reciente al m\xE1s antiguo.",
|
|
423
434
|
docs: "Documentaci\xF3n",
|
|
424
435
|
menu: "Men\xFA",
|
|
436
|
+
closeMenu: "Cerrar el men\xFA",
|
|
437
|
+
updated: "\xDAltima actualizaci\xF3n",
|
|
425
438
|
nfKind: "404 \xB7 No encontrada",
|
|
426
439
|
nfTitle: "Esta p\xE1gina no existe",
|
|
427
440
|
nfBody: "Puede que la direcci\xF3n est\xE9 mal escrita, o que el documento se haya despublicado o movido.",
|
|
@@ -541,7 +554,7 @@ function HastContent({ tree, title, components = {}, locale }) {
|
|
|
541
554
|
});
|
|
542
555
|
}
|
|
543
556
|
function TrustedServerHtml({ html }) {
|
|
544
|
-
return /* @__PURE__ */ jsx3("div", { dangerouslySetInnerHTML: { __html: html } });
|
|
557
|
+
return /* @__PURE__ */ jsx3("div", { dangerouslySetInnerHTML: { __html: hostAssetHtml(html) } });
|
|
545
558
|
}
|
|
546
559
|
|
|
547
560
|
// src/react/index.ts
|
|
@@ -724,69 +737,6 @@ function ListPage({ list, olderHref, description, ...base }) {
|
|
|
724
737
|
] }) : null
|
|
725
738
|
] }) });
|
|
726
739
|
}
|
|
727
|
-
function DocsTree({ article, c }) {
|
|
728
|
-
const { Link, s } = c;
|
|
729
|
-
const current = /* @__PURE__ */ jsxs4("li", { children: [
|
|
730
|
-
/* @__PURE__ */ jsx4(Link, { href: c.href(article.publication.canonical_path), "aria-current": "page", children: article.publication.title }),
|
|
731
|
-
article.children.length > 0 ? /* @__PURE__ */ jsx4("ul", { children: article.children.map((ch) => /* @__PURE__ */ jsx4("li", { children: /* @__PURE__ */ jsx4(Link, { href: c.href(ch.canonical_path), children: ch.title }) }, ch.canonical_path)) }) : null
|
|
732
|
-
] });
|
|
733
|
-
const nested = article.ancestors.reduceRight(
|
|
734
|
-
(inner, a) => /* @__PURE__ */ jsxs4("li", { children: [
|
|
735
|
-
/* @__PURE__ */ jsx4(Link, { href: c.href(a.canonical_path), children: a.title }),
|
|
736
|
-
/* @__PURE__ */ jsx4("ul", { children: inner })
|
|
737
|
-
] }, a.canonical_path),
|
|
738
|
-
current
|
|
739
|
-
);
|
|
740
|
-
return /* @__PURE__ */ jsx4("nav", { className: "hyle-tree", "aria-label": s.docs, children: /* @__PURE__ */ jsx4("ul", { children: nested }) });
|
|
741
|
-
}
|
|
742
|
-
function DocsPage({ article, ...base }) {
|
|
743
|
-
const { publication: pub } = article;
|
|
744
|
-
const c = ctx(base, pub.locale);
|
|
745
|
-
const { Link, s } = c;
|
|
746
|
-
const toc = Toc({ toc: article.toc, c });
|
|
747
|
-
const siteName = article.breadcrumbs[0]?.title ?? "";
|
|
748
|
-
const version = /* @__PURE__ */ jsx4(Slot, { name: "docs.version", slots: base.slots, tag: "span" });
|
|
749
|
-
const side = /* @__PURE__ */ jsxs4(Fragment4, { children: [
|
|
750
|
-
/* @__PURE__ */ jsxs4("div", { className: "hyle-side-head", children: [
|
|
751
|
-
/* @__PURE__ */ jsx4("b", { children: siteName }),
|
|
752
|
-
version
|
|
753
|
-
] }),
|
|
754
|
-
/* @__PURE__ */ jsx4(Slot, { name: "docs.sidebar-header", slots: base.slots, className: "hyle-side-slot" }),
|
|
755
|
-
/* @__PURE__ */ jsx4(DocsTree, { article, c }),
|
|
756
|
-
/* @__PURE__ */ jsx4(Slot, { name: "docs.sidebar-footer", slots: base.slots, className: "hyle-side-slot" })
|
|
757
|
-
] });
|
|
758
|
-
const notTranslated = article.fallback ? s.fallbackTitle.replace("{language}", languageName(article.fallback.requested_locale, c.locale)) : void 0;
|
|
759
|
-
return /* @__PURE__ */ jsx4(Shell, { children: /* @__PURE__ */ jsxs4("div", { className: "hyle-docs", lang: c.locale, children: [
|
|
760
|
-
/* @__PURE__ */ jsxs4("details", { className: "hyle-nav-m", children: [
|
|
761
|
-
/* @__PURE__ */ jsxs4("summary", { children: [
|
|
762
|
-
/* @__PURE__ */ jsx4(Icon, { name: "file" }),
|
|
763
|
-
s.menu,
|
|
764
|
-
/* @__PURE__ */ jsx4("span", { className: "cur", children: pub.title }),
|
|
765
|
-
/* @__PURE__ */ jsx4(Icon, { name: "chev-down", className: "hyle-chev" })
|
|
766
|
-
] }),
|
|
767
|
-
/* @__PURE__ */ jsx4("div", { children: side })
|
|
768
|
-
] }),
|
|
769
|
-
/* @__PURE__ */ jsx4("aside", { className: "hyle-nav-d", "aria-label": s.docs, children: side }),
|
|
770
|
-
/* @__PURE__ */ jsxs4("div", { className: "hyle-docs-main", "data-hyle-page": "docs", children: [
|
|
771
|
-
notTranslated ? /* @__PURE__ */ jsxs4("div", { className: "hyle-banner", "data-kind": "warn", role: "status", children: [
|
|
772
|
-
/* @__PURE__ */ jsx4(Icon, { name: "alert" }),
|
|
773
|
-
/* @__PURE__ */ jsxs4("div", { children: [
|
|
774
|
-
/* @__PURE__ */ jsx4("b", { children: notTranslated }),
|
|
775
|
-
" ",
|
|
776
|
-
s.fallbackBody
|
|
777
|
-
] })
|
|
778
|
-
] }) : null,
|
|
779
|
-
/* @__PURE__ */ jsx4("nav", { className: "hyle-crumbs", "aria-label": s.crumbs, children: /* @__PURE__ */ jsx4("ol", { children: article.breadcrumbs.map((b, i) => /* @__PURE__ */ jsx4("li", { "aria-current": i === article.breadcrumbs.length - 1 ? "page" : void 0, children: i === article.breadcrumbs.length - 1 ? b.title : /* @__PURE__ */ jsx4(Link, { href: c.href(b.canonical_path), children: b.title }) }, b.canonical_path)) }) }),
|
|
780
|
-
/* @__PURE__ */ jsx4("h1", { className: "hyle-title", children: pub.title }),
|
|
781
|
-
pub.description ? /* @__PURE__ */ jsx4("p", { className: "hyle-desc", children: pub.description }) : null,
|
|
782
|
-
toc.narrow,
|
|
783
|
-
/* @__PURE__ */ jsx4(Body, { article, components: base.components, locale: c.locale }),
|
|
784
|
-
/* @__PURE__ */ jsx4(Pager, { prev: article.prev, next: article.next, c }),
|
|
785
|
-
/* @__PURE__ */ jsx4(Slot, { name: "docs.after", slots: base.slots, className: "hyle-after" })
|
|
786
|
-
] }),
|
|
787
|
-
toc.wide
|
|
788
|
-
] }) });
|
|
789
|
-
}
|
|
790
740
|
function NotFound({ path, homeHref = "/", ...base }) {
|
|
791
741
|
const c = ctx(base, "en");
|
|
792
742
|
const { Link, s } = c;
|
|
@@ -836,6 +786,100 @@ function Redirecting({ from, to, ...base }) {
|
|
|
836
786
|
] }) });
|
|
837
787
|
}
|
|
838
788
|
|
|
789
|
+
// src/react/docs.tsx
|
|
790
|
+
import { DocsEnhance } from "./docs-enhance.js";
|
|
791
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
792
|
+
var ROOT_ID = "hyle-docs";
|
|
793
|
+
var NAV_ID = "hyle-docs-nav";
|
|
794
|
+
function navTreeOf(article) {
|
|
795
|
+
if (article.nav && !article.nav.truncated && article.nav.items.length > 0) return article.nav.items;
|
|
796
|
+
const { publication: pub } = article;
|
|
797
|
+
const here = {
|
|
798
|
+
slug: pub.slug,
|
|
799
|
+
title: pub.title,
|
|
800
|
+
canonical_path: pub.canonical_path,
|
|
801
|
+
children: article.children.map((child) => ({ ...child, children: [] }))
|
|
802
|
+
};
|
|
803
|
+
return [article.ancestors.reduceRight((inner, a) => ({ ...a, children: [inner] }), here)];
|
|
804
|
+
}
|
|
805
|
+
function pathTo(nodes, path) {
|
|
806
|
+
for (const node of nodes) {
|
|
807
|
+
if (node.canonical_path === path) return [node.canonical_path];
|
|
808
|
+
const below = pathTo(node.children, path);
|
|
809
|
+
if (below.length > 0) return [node.canonical_path, ...below];
|
|
810
|
+
}
|
|
811
|
+
return [];
|
|
812
|
+
}
|
|
813
|
+
function Branch({ nodes, current, onPath, c }) {
|
|
814
|
+
const { Link } = c;
|
|
815
|
+
return /* @__PURE__ */ jsx5("ul", { children: nodes.map((node) => {
|
|
816
|
+
const link = /* @__PURE__ */ jsx5(Link, { href: c.href(node.canonical_path), ...node.canonical_path === current ? { "aria-current": "page" } : {}, children: node.title });
|
|
817
|
+
if (node.children.length === 0) return /* @__PURE__ */ jsx5("li", { children: link }, node.canonical_path);
|
|
818
|
+
return /* @__PURE__ */ jsx5("li", { children: /* @__PURE__ */ jsxs5("details", { ...onPath.has(node.canonical_path) ? { open: true } : {}, children: [
|
|
819
|
+
/* @__PURE__ */ jsxs5("summary", { children: [
|
|
820
|
+
/* @__PURE__ */ jsx5(Icon, { name: "chev" }),
|
|
821
|
+
link
|
|
822
|
+
] }),
|
|
823
|
+
/* @__PURE__ */ jsx5(Branch, { nodes: node.children, current, onPath, c })
|
|
824
|
+
] }) }, node.canonical_path);
|
|
825
|
+
}) });
|
|
826
|
+
}
|
|
827
|
+
function DocsPage({ article, ...base }) {
|
|
828
|
+
const { publication: pub } = article;
|
|
829
|
+
const c = ctx(base, pub.locale);
|
|
830
|
+
const { Link, s } = c;
|
|
831
|
+
const toc = Toc({ toc: article.toc, c });
|
|
832
|
+
const tree = navTreeOf(article);
|
|
833
|
+
const onPath = new Set(pathTo(tree, pub.canonical_path));
|
|
834
|
+
const siteName = article.breadcrumbs[0]?.title ?? "";
|
|
835
|
+
const headingIds = article.toc.filter((t) => t.depth === 2 || t.depth === 3).map((t) => scopeId(t.id));
|
|
836
|
+
const notTranslated = article.fallback ? s.fallbackTitle.replace("{language}", languageName(article.fallback.requested_locale, c.locale)) : void 0;
|
|
837
|
+
return /* @__PURE__ */ jsx5(Shell, { children: /* @__PURE__ */ jsxs5("div", { className: "hyle-docs", id: ROOT_ID, lang: c.locale, children: [
|
|
838
|
+
/* @__PURE__ */ jsx5(DocsEnhance, { headingIds, rootId: ROOT_ID }),
|
|
839
|
+
/* @__PURE__ */ jsxs5("button", { type: "button", className: "hyle-nav-bar", popoverTarget: NAV_ID, children: [
|
|
840
|
+
/* @__PURE__ */ jsx5(Icon, { name: "file" }),
|
|
841
|
+
s.menu,
|
|
842
|
+
/* @__PURE__ */ jsx5("span", { className: "cur", children: pub.title }),
|
|
843
|
+
/* @__PURE__ */ jsx5(Icon, { name: "chev-down", className: "hyle-chev" })
|
|
844
|
+
] }),
|
|
845
|
+
/* @__PURE__ */ jsxs5("aside", { className: "hyle-nav-d", id: NAV_ID, popover: "auto", "aria-label": s.docs, children: [
|
|
846
|
+
/* @__PURE__ */ jsxs5("div", { className: "hyle-side-head", children: [
|
|
847
|
+
/* @__PURE__ */ jsx5("b", { children: siteName }),
|
|
848
|
+
/* @__PURE__ */ jsx5(Slot, { name: "docs.version", slots: base.slots, tag: "span" }),
|
|
849
|
+
/* @__PURE__ */ jsx5("button", { type: "button", className: "hyle-nav-x", popoverTarget: NAV_ID, popoverTargetAction: "hide", "aria-label": s.closeMenu, children: /* @__PURE__ */ jsx5(Icon, { name: "x" }) })
|
|
850
|
+
] }),
|
|
851
|
+
/* @__PURE__ */ jsx5(Slot, { name: "docs.sidebar-header", slots: base.slots, className: "hyle-side-slot" }),
|
|
852
|
+
/* @__PURE__ */ jsx5("nav", { className: "hyle-tree", "aria-label": s.docs, children: /* @__PURE__ */ jsx5(Branch, { nodes: tree, current: pub.canonical_path, onPath, c }) }),
|
|
853
|
+
/* @__PURE__ */ jsx5(Slot, { name: "docs.sidebar-footer", slots: base.slots, className: "hyle-side-slot" })
|
|
854
|
+
] }),
|
|
855
|
+
/* @__PURE__ */ jsxs5("div", { className: "hyle-docs-main", "data-hyle-page": "docs", children: [
|
|
856
|
+
notTranslated ? /* @__PURE__ */ jsxs5("div", { className: "hyle-banner", "data-kind": "warn", role: "status", children: [
|
|
857
|
+
/* @__PURE__ */ jsx5(Icon, { name: "alert" }),
|
|
858
|
+
/* @__PURE__ */ jsxs5("div", { children: [
|
|
859
|
+
/* @__PURE__ */ jsx5("b", { children: notTranslated }),
|
|
860
|
+
" ",
|
|
861
|
+
s.fallbackBody
|
|
862
|
+
] })
|
|
863
|
+
] }) : null,
|
|
864
|
+
/* @__PURE__ */ jsx5("nav", { className: "hyle-crumbs", "aria-label": s.crumbs, children: /* @__PURE__ */ jsx5("ol", { children: article.breadcrumbs.map((b, i) => /* @__PURE__ */ jsx5("li", { "aria-current": i === article.breadcrumbs.length - 1 ? "page" : void 0, children: i === article.breadcrumbs.length - 1 ? b.title : /* @__PURE__ */ jsx5(Link, { href: c.href(b.canonical_path), children: b.title }) }, b.canonical_path)) }) }),
|
|
865
|
+
/* @__PURE__ */ jsx5("h1", { className: "hyle-title", children: pub.title }),
|
|
866
|
+
pub.description ? /* @__PURE__ */ jsx5("p", { className: "hyle-desc", children: pub.description }) : null,
|
|
867
|
+
/* @__PURE__ */ jsxs5("p", { className: "hyle-updated", children: [
|
|
868
|
+
/* @__PURE__ */ jsx5(Icon, { name: "calendar" }),
|
|
869
|
+
s.updated,
|
|
870
|
+
" ",
|
|
871
|
+
/* @__PURE__ */ jsx5("time", { dateTime: pub.updated_at, title: pub.updated_at, children: formatDate(pub.updated_at, c.locale) })
|
|
872
|
+
] }),
|
|
873
|
+
toc.narrow,
|
|
874
|
+
/* @__PURE__ */ jsx5(Body, { article, components: base.components, locale: c.locale }),
|
|
875
|
+
/* @__PURE__ */ jsx5(Pager, { prev: article.prev, next: article.next, c }),
|
|
876
|
+
/* @__PURE__ */ jsx5(Slot, { name: "docs.after", slots: base.slots, className: "hyle-after" }),
|
|
877
|
+
/* @__PURE__ */ jsx5("span", { className: "hyle-docs-end", "aria-hidden": "true" })
|
|
878
|
+
] }),
|
|
879
|
+
toc.wide
|
|
880
|
+
] }) });
|
|
881
|
+
}
|
|
882
|
+
|
|
839
883
|
export {
|
|
840
884
|
HastLimitError,
|
|
841
885
|
scopeId,
|
|
@@ -846,9 +890,9 @@ export {
|
|
|
846
890
|
TrustedServerHtml,
|
|
847
891
|
ArticlePage,
|
|
848
892
|
ListPage,
|
|
849
|
-
DocsPage,
|
|
850
893
|
NotFound,
|
|
851
894
|
Unavailable,
|
|
852
895
|
Redirecting,
|
|
896
|
+
DocsPage,
|
|
853
897
|
MermaidDiagram2 as MermaidDiagram
|
|
854
898
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createHyleClient,
|
|
3
3
|
isValidCacheTag
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-54JF4E53.js";
|
|
5
5
|
|
|
6
6
|
// src/next/resolve.ts
|
|
7
7
|
var DEFAULT_REVALIDATE = 300;
|
|
@@ -19,8 +19,9 @@ function fetchResolver(options) {
|
|
|
19
19
|
const client = createHyleClient({ baseUrl: options.baseUrl, token: options.token });
|
|
20
20
|
const revalidate = options.revalidate ?? DEFAULT_REVALIDATE;
|
|
21
21
|
const tags = workspaceTags(options.workspaceId, options.sections);
|
|
22
|
-
return (path, locale, limit, cursor) => client.resolve({
|
|
22
|
+
return (path, locale, limit, cursor, nav) => client.resolve({
|
|
23
23
|
path,
|
|
24
|
+
...nav !== void 0 ? { nav } : {},
|
|
24
25
|
...locale !== void 0 ? { locale } : {},
|
|
25
26
|
...limit !== void 0 ? { limit } : {},
|
|
26
27
|
...cursor !== void 0 ? { cursor } : {},
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/react/docs-enhance.tsx
|
|
22
|
+
var docs_enhance_exports = {};
|
|
23
|
+
__export(docs_enhance_exports, {
|
|
24
|
+
DocsEnhance: () => DocsEnhance
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(docs_enhance_exports);
|
|
27
|
+
var import_react = require("react");
|
|
28
|
+
var REACHED_SLACK = 24 + 8;
|
|
29
|
+
function stickyTop(root) {
|
|
30
|
+
return Number.parseFloat(getComputedStyle(root).getPropertyValue("--h-sticky-top")) || 0;
|
|
31
|
+
}
|
|
32
|
+
function setCurrent(root, id) {
|
|
33
|
+
for (const link of Array.from(root.querySelectorAll(".hyle-toc-list a[href^='#']"))) {
|
|
34
|
+
if (id !== void 0 && link.getAttribute("href") === `#${id}`) link.setAttribute("aria-current", "location");
|
|
35
|
+
else link.removeAttribute("aria-current");
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function revealCurrent(nav) {
|
|
39
|
+
const row = nav.querySelector("[aria-current='page']");
|
|
40
|
+
if (!row || nav.scrollHeight <= nav.clientHeight) return;
|
|
41
|
+
const a = row.getBoundingClientRect();
|
|
42
|
+
const b = nav.getBoundingClientRect();
|
|
43
|
+
if (a.top < b.top || a.bottom > b.bottom) nav.scrollTop += a.top - b.top - b.height / 3;
|
|
44
|
+
}
|
|
45
|
+
function DocsEnhance({ headingIds, rootId }) {
|
|
46
|
+
const key = headingIds.join("\n");
|
|
47
|
+
(0, import_react.useEffect)(() => {
|
|
48
|
+
const root = document.getElementById(rootId);
|
|
49
|
+
if (!root) return;
|
|
50
|
+
const nav = root.querySelector(".hyle-nav-d");
|
|
51
|
+
const cleanups = [];
|
|
52
|
+
if (nav) {
|
|
53
|
+
revealCurrent(nav);
|
|
54
|
+
const onToggle = (e) => {
|
|
55
|
+
if (e.newState !== "open") return;
|
|
56
|
+
revealCurrent(nav);
|
|
57
|
+
nav.querySelector(".hyle-nav-x")?.focus();
|
|
58
|
+
};
|
|
59
|
+
const onClick = (e) => {
|
|
60
|
+
if (!(e.target instanceof Element) || !e.target.closest("a")) return;
|
|
61
|
+
try {
|
|
62
|
+
if (nav.matches(":popover-open")) nav.hidePopover();
|
|
63
|
+
} catch {
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
nav.addEventListener("toggle", onToggle);
|
|
67
|
+
nav.addEventListener("click", onClick);
|
|
68
|
+
cleanups.push(() => (nav.removeEventListener("toggle", onToggle), nav.removeEventListener("click", onClick)));
|
|
69
|
+
}
|
|
70
|
+
const headings = headingIds.map((id) => document.getElementById(id)).filter((h) => h !== null);
|
|
71
|
+
const end = root.querySelector(".hyle-docs-end");
|
|
72
|
+
if (headings.length > 0 && typeof IntersectionObserver === "function") {
|
|
73
|
+
let endVisible = false;
|
|
74
|
+
const update = () => {
|
|
75
|
+
const line = stickyTop(root) + REACHED_SLACK;
|
|
76
|
+
let active = headings[0];
|
|
77
|
+
for (const h of headings) if (h.getBoundingClientRect().top <= line) active = h;
|
|
78
|
+
if (endVisible && window.scrollY > 0) active = headings.at(-1);
|
|
79
|
+
setCurrent(root, active?.id);
|
|
80
|
+
};
|
|
81
|
+
const io = new IntersectionObserver((entries) => {
|
|
82
|
+
for (const entry of entries) if (entry.target === end) endVisible = entry.isIntersecting;
|
|
83
|
+
update();
|
|
84
|
+
});
|
|
85
|
+
for (const h of headings) io.observe(h);
|
|
86
|
+
if (end) io.observe(end);
|
|
87
|
+
update();
|
|
88
|
+
cleanups.push(() => (io.disconnect(), setCurrent(root, void 0)));
|
|
89
|
+
}
|
|
90
|
+
return () => cleanups.forEach((fn) => fn());
|
|
91
|
+
}, [key, rootId]);
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
95
|
+
0 && (module.exports = {
|
|
96
|
+
DocsEnhance
|
|
97
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Progressive enhancement for DocsPage. It renders nothing and receives only the heading ids and the root element's id: the
|
|
3
|
+
* page works without it (the tree is `<details>`, the drawer is a `popover`), and this adds three things, with no dependency:
|
|
4
|
+
* scroll-spy for the on-page TOC (IntersectionObserver on the headings plus one on the end of the article, `aria-current="location"`
|
|
5
|
+
* set on the DOM links so it never re-renders), the current page scrolled into view in the sidebar, and the drawer closing
|
|
6
|
+
* when a link in it is followed (a client-side navigation does not reload the page, so the popover would stay open).
|
|
7
|
+
*/
|
|
8
|
+
interface DocsEnhanceProps {
|
|
9
|
+
/** The `id` of the heading elements to follow, in document order (already scoped, as in the TOC hrefs). */
|
|
10
|
+
headingIds: readonly string[];
|
|
11
|
+
/** The `id` of `.hyle-docs`. */
|
|
12
|
+
rootId: string;
|
|
13
|
+
}
|
|
14
|
+
declare function DocsEnhance({ headingIds, rootId }: DocsEnhanceProps): null;
|
|
15
|
+
|
|
16
|
+
export { DocsEnhance, type DocsEnhanceProps };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Progressive enhancement for DocsPage. It renders nothing and receives only the heading ids and the root element's id: the
|
|
3
|
+
* page works without it (the tree is `<details>`, the drawer is a `popover`), and this adds three things, with no dependency:
|
|
4
|
+
* scroll-spy for the on-page TOC (IntersectionObserver on the headings plus one on the end of the article, `aria-current="location"`
|
|
5
|
+
* set on the DOM links so it never re-renders), the current page scrolled into view in the sidebar, and the drawer closing
|
|
6
|
+
* when a link in it is followed (a client-side navigation does not reload the page, so the popover would stay open).
|
|
7
|
+
*/
|
|
8
|
+
interface DocsEnhanceProps {
|
|
9
|
+
/** The `id` of the heading elements to follow, in document order (already scoped, as in the TOC hrefs). */
|
|
10
|
+
headingIds: readonly string[];
|
|
11
|
+
/** The `id` of `.hyle-docs`. */
|
|
12
|
+
rootId: string;
|
|
13
|
+
}
|
|
14
|
+
declare function DocsEnhance({ headingIds, rootId }: DocsEnhanceProps): null;
|
|
15
|
+
|
|
16
|
+
export { DocsEnhance, type DocsEnhanceProps };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/react/docs-enhance.tsx
|
|
4
|
+
import { useEffect } from "react";
|
|
5
|
+
var REACHED_SLACK = 24 + 8;
|
|
6
|
+
function stickyTop(root) {
|
|
7
|
+
return Number.parseFloat(getComputedStyle(root).getPropertyValue("--h-sticky-top")) || 0;
|
|
8
|
+
}
|
|
9
|
+
function setCurrent(root, id) {
|
|
10
|
+
for (const link of Array.from(root.querySelectorAll(".hyle-toc-list a[href^='#']"))) {
|
|
11
|
+
if (id !== void 0 && link.getAttribute("href") === `#${id}`) link.setAttribute("aria-current", "location");
|
|
12
|
+
else link.removeAttribute("aria-current");
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function revealCurrent(nav) {
|
|
16
|
+
const row = nav.querySelector("[aria-current='page']");
|
|
17
|
+
if (!row || nav.scrollHeight <= nav.clientHeight) return;
|
|
18
|
+
const a = row.getBoundingClientRect();
|
|
19
|
+
const b = nav.getBoundingClientRect();
|
|
20
|
+
if (a.top < b.top || a.bottom > b.bottom) nav.scrollTop += a.top - b.top - b.height / 3;
|
|
21
|
+
}
|
|
22
|
+
function DocsEnhance({ headingIds, rootId }) {
|
|
23
|
+
const key = headingIds.join("\n");
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
const root = document.getElementById(rootId);
|
|
26
|
+
if (!root) return;
|
|
27
|
+
const nav = root.querySelector(".hyle-nav-d");
|
|
28
|
+
const cleanups = [];
|
|
29
|
+
if (nav) {
|
|
30
|
+
revealCurrent(nav);
|
|
31
|
+
const onToggle = (e) => {
|
|
32
|
+
if (e.newState !== "open") return;
|
|
33
|
+
revealCurrent(nav);
|
|
34
|
+
nav.querySelector(".hyle-nav-x")?.focus();
|
|
35
|
+
};
|
|
36
|
+
const onClick = (e) => {
|
|
37
|
+
if (!(e.target instanceof Element) || !e.target.closest("a")) return;
|
|
38
|
+
try {
|
|
39
|
+
if (nav.matches(":popover-open")) nav.hidePopover();
|
|
40
|
+
} catch {
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
nav.addEventListener("toggle", onToggle);
|
|
44
|
+
nav.addEventListener("click", onClick);
|
|
45
|
+
cleanups.push(() => (nav.removeEventListener("toggle", onToggle), nav.removeEventListener("click", onClick)));
|
|
46
|
+
}
|
|
47
|
+
const headings = headingIds.map((id) => document.getElementById(id)).filter((h) => h !== null);
|
|
48
|
+
const end = root.querySelector(".hyle-docs-end");
|
|
49
|
+
if (headings.length > 0 && typeof IntersectionObserver === "function") {
|
|
50
|
+
let endVisible = false;
|
|
51
|
+
const update = () => {
|
|
52
|
+
const line = stickyTop(root) + REACHED_SLACK;
|
|
53
|
+
let active = headings[0];
|
|
54
|
+
for (const h of headings) if (h.getBoundingClientRect().top <= line) active = h;
|
|
55
|
+
if (endVisible && window.scrollY > 0) active = headings.at(-1);
|
|
56
|
+
setCurrent(root, active?.id);
|
|
57
|
+
};
|
|
58
|
+
const io = new IntersectionObserver((entries) => {
|
|
59
|
+
for (const entry of entries) if (entry.target === end) endVisible = entry.isIntersecting;
|
|
60
|
+
update();
|
|
61
|
+
});
|
|
62
|
+
for (const h of headings) io.observe(h);
|
|
63
|
+
if (end) io.observe(end);
|
|
64
|
+
update();
|
|
65
|
+
cleanups.push(() => (io.disconnect(), setCurrent(root, void 0)));
|
|
66
|
+
}
|
|
67
|
+
return () => cleanups.forEach((fn) => fn());
|
|
68
|
+
}, [key, rootId]);
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
export {
|
|
72
|
+
DocsEnhance
|
|
73
|
+
};
|
package/dist/index.cjs
CHANGED
|
@@ -23,6 +23,7 @@ __export(src_exports, {
|
|
|
23
23
|
CACHE_TAG_PATTERN: () => CACHE_TAG_PATTERN,
|
|
24
24
|
Cp1ClientError: () => Cp1ClientError,
|
|
25
25
|
DeliveryDedupe: () => DeliveryDedupe,
|
|
26
|
+
SDK_OWN_RESERVED: () => SDK_OWN_RESERVED,
|
|
26
27
|
checkRoutes: () => checkRoutes,
|
|
27
28
|
createHyleClient: () => createHyleClient,
|
|
28
29
|
createRevalidationCallbackRoute: () => createRevalidationCallbackRoute,
|
|
@@ -34,10 +35,19 @@ __export(src_exports, {
|
|
|
34
35
|
parseSignatureHeader: () => parseSignatureHeader,
|
|
35
36
|
reservedFor: () => reservedFor,
|
|
36
37
|
routeMatches: () => routeMatches,
|
|
38
|
+
syncHostReserved: () => syncHostReserved,
|
|
37
39
|
verifyHyleSignature: () => verifyHyleSignature
|
|
38
40
|
});
|
|
39
41
|
module.exports = __toCommonJS(src_exports);
|
|
40
42
|
|
|
43
|
+
// src/asset-path.ts
|
|
44
|
+
var ASSET_ROUTE_PREFIX = "/api/hyle/assets";
|
|
45
|
+
var ASSET_RESERVED_PATH = "/api/hyle/*";
|
|
46
|
+
var UUID = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}";
|
|
47
|
+
var EXTENSIONS = "png|jpg|gif|webp|svg|pdf|mp4|webm|mp3|ogg";
|
|
48
|
+
var ASSET_FILE = new RegExp(`^${UUID}(?:\\.(?:${EXTENSIONS}))?$`);
|
|
49
|
+
var HYLE_ASSET_URL = new RegExp(`^/assets/(${UUID}(?:\\.(?:${EXTENSIONS}))?)$`, "i");
|
|
50
|
+
|
|
41
51
|
// src/errors.ts
|
|
42
52
|
var Cp1ClientError = class extends Error {
|
|
43
53
|
code;
|
|
@@ -83,16 +93,19 @@ function isMounts(data) {
|
|
|
83
93
|
const mounts = data.mounts;
|
|
84
94
|
return typeof data.workspace_id === "string" && isStrings(data.reserved) && isStrings(data.supported_locales) && Array.isArray(mounts) && mounts.every((m) => typeof m?.prefix === "string" && typeof m.default_section === "string");
|
|
85
95
|
}
|
|
86
|
-
function
|
|
96
|
+
function checkBaseUrl(baseUrl, allowInsecureHttp) {
|
|
87
97
|
let origin;
|
|
88
98
|
try {
|
|
89
|
-
origin = new URL(
|
|
99
|
+
origin = new URL(baseUrl);
|
|
90
100
|
} catch {
|
|
91
101
|
throw new TypeError("baseUrl must be an https origin");
|
|
92
102
|
}
|
|
93
|
-
if (origin.protocol !== "https:" && !(origin.protocol === "http:" && (
|
|
103
|
+
if (origin.protocol !== "https:" && !(origin.protocol === "http:" && (allowInsecureHttp || LOOPBACK.has(origin.hostname)))) {
|
|
94
104
|
throw new TypeError("baseUrl must be https (http is allowed only for localhost, or with allowInsecureHttp)");
|
|
95
105
|
}
|
|
106
|
+
}
|
|
107
|
+
function createHyleClient(options) {
|
|
108
|
+
checkBaseUrl(options.baseUrl, options.allowInsecureHttp);
|
|
96
109
|
if (!options.token) throw new TypeError("token is required");
|
|
97
110
|
const base = options.baseUrl.replace(/\/+$/, "");
|
|
98
111
|
const fetchImpl = options.fetch ?? fetch;
|
|
@@ -121,6 +134,7 @@ function createHyleClient(options) {
|
|
|
121
134
|
const query = new URLSearchParams({ path: opts.path });
|
|
122
135
|
if (opts.locale !== void 0) query.set("locale", opts.locale);
|
|
123
136
|
if (opts.format !== void 0) query.set("format", opts.format);
|
|
137
|
+
if (opts.nav !== void 0) query.set("nav", opts.nav);
|
|
124
138
|
if (opts.cursor !== void 0) query.set("cursor", opts.cursor);
|
|
125
139
|
if (opts.limit !== void 0) query.set("limit", String(opts.limit));
|
|
126
140
|
const reply = await get("/cp1/read/resolve", query, opts.init);
|
|
@@ -135,7 +149,56 @@ function createHyleClient(options) {
|
|
|
135
149
|
if (data?.cp === 1 && data.kind === "mounts" && isMounts(data)) return data;
|
|
136
150
|
throw failure(reply);
|
|
137
151
|
}
|
|
138
|
-
|
|
152
|
+
async function asset(file, opts = {}) {
|
|
153
|
+
if (!ASSET_FILE.test(file)) throw new TypeError("asset file must be <uuid>[.<ext>]");
|
|
154
|
+
const headers = new Headers({ authorization: `Bearer ${options.token}` });
|
|
155
|
+
for (const name of ["range", "if-range", "if-none-match"]) {
|
|
156
|
+
const value = opts.headers?.[name];
|
|
157
|
+
if (value) headers.set(name, value);
|
|
158
|
+
}
|
|
159
|
+
return fetchImpl(`${base}/cp1/read/assets/${file}`, { method: "GET", headers, redirect: "error", signal: AbortSignal.timeout(opts.timeoutMs ?? options.timeoutMs ?? DEFAULT_TIMEOUT_MS) });
|
|
160
|
+
}
|
|
161
|
+
return { resolve, mounts, asset };
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// src/host-sync.ts
|
|
165
|
+
var CONTROL_TOKEN_PREFIX = "hyle_tc_";
|
|
166
|
+
var DEFAULT_TIMEOUT_MS2 = 1e4;
|
|
167
|
+
var MAX_RESPONSE_BYTES = 1024 * 1024;
|
|
168
|
+
var PATH = "/cp1/control/workspace/host-reserved-paths";
|
|
169
|
+
async function syncHostReserved(input) {
|
|
170
|
+
checkBaseUrl(input.baseUrl, input.allowInsecureHttp);
|
|
171
|
+
if (!input.token.startsWith(CONTROL_TOKEN_PREFIX)) {
|
|
172
|
+
throw new TypeError("syncing needs a control credential (hyle_tc_...); a target token is read-only and cannot write");
|
|
173
|
+
}
|
|
174
|
+
const fetchImpl = input.fetch ?? fetch;
|
|
175
|
+
const res = await fetchImpl(`${input.baseUrl.replace(/\/+$/, "")}${PATH}`, {
|
|
176
|
+
method: "PUT",
|
|
177
|
+
// redirect "error": the bearer token must never follow a redirect to another host.
|
|
178
|
+
redirect: "error",
|
|
179
|
+
signal: AbortSignal.timeout(input.timeoutMs ?? DEFAULT_TIMEOUT_MS2),
|
|
180
|
+
headers: {
|
|
181
|
+
authorization: `Bearer ${input.token}`,
|
|
182
|
+
"content-type": "application/json",
|
|
183
|
+
"cp-workspace": input.workspaceId,
|
|
184
|
+
"idempotency-key": `sync-${crypto.randomUUID()}`
|
|
185
|
+
},
|
|
186
|
+
body: JSON.stringify({ paths: input.paths, host: input.host, build_id: input.buildId })
|
|
187
|
+
});
|
|
188
|
+
const text = await readCapped(res, MAX_RESPONSE_BYTES);
|
|
189
|
+
let parsed;
|
|
190
|
+
try {
|
|
191
|
+
parsed = JSON.parse(text);
|
|
192
|
+
} catch {
|
|
193
|
+
parsed = void 0;
|
|
194
|
+
}
|
|
195
|
+
const data = parsed?.data;
|
|
196
|
+
const conflicts = data?.conflicts;
|
|
197
|
+
if (res.ok && data && Array.isArray(data.paths) && typeof data.changed === "boolean" && typeof data.synced_at === "string" && typeof conflicts?.total === "number" && Array.isArray(conflicts.offenders)) {
|
|
198
|
+
return { paths: data.paths, changed: data.changed, syncedAt: data.synced_at, conflicts: { total: conflicts.total, offenders: conflicts.offenders } };
|
|
199
|
+
}
|
|
200
|
+
const err = parsed?.error;
|
|
201
|
+
throw new Cp1ClientError(err?.code ?? "INVALID_RESPONSE", err?.message ?? `Unexpected response from hyle (HTTP ${res.status})`, res.status, err?.request_id ?? "", err?.details);
|
|
139
202
|
}
|
|
140
203
|
|
|
141
204
|
// src/delivery-dedupe.ts
|
|
@@ -425,29 +488,50 @@ function checkRoutes(input) {
|
|
|
425
488
|
const shown = hostWins.length > 0 ? hostWins : matched;
|
|
426
489
|
dynamicOverlaps.push({ route, verdict: hostWins.length > 0 ? "host-wins" : "hyle-wins", matches: shown.length, examples: shown.slice(0, MAX_EXAMPLES) });
|
|
427
490
|
}
|
|
491
|
+
if (!routes.some((r) => r.startsWith(`${ASSET_ROUTE_PREFIX}/`))) {
|
|
492
|
+
notes.push(`no asset route (${ASSET_ROUTE_PREFIX}/[file], createAssetRoute) was found in the host routes: images, video and audio in hyle content will 404`);
|
|
493
|
+
}
|
|
428
494
|
if (catchAlls.length === 0) notes.push(`no hyle catch-all route (a "[...${hyleParam}]" or "[[...${hyleParam}]]" page) was found in the host routes`);
|
|
429
495
|
return { shadowedHylePaths, mountCollisions, dynamicOverlaps, notes, ok: shadowedHylePaths.length === 0 && mountCollisions.length === 0 };
|
|
430
496
|
}
|
|
497
|
+
var SDK_OWN_RESERVED = [ASSET_RESERVED_PATH];
|
|
498
|
+
var HASHED_METADATA_ROUTE = /^(opengraph-image|twitter-image|icon|apple-icon)-[a-z0-9]{5,8}$/;
|
|
499
|
+
var isHashedMetadataRoute = (route) => HASHED_METADATA_ROUTE.test(segmentsOf(route).at(-1) ?? "");
|
|
500
|
+
var covers = (entry, path) => {
|
|
501
|
+
if (!entry.endsWith("/*")) return entry === path;
|
|
502
|
+
const base = entry.slice(0, -2);
|
|
503
|
+
return path === base || path.startsWith(`${base}/`);
|
|
504
|
+
};
|
|
431
505
|
function reservedFor(hostRoutes, options = {}) {
|
|
432
506
|
const dropLocale = (route) => {
|
|
433
507
|
const [first, ...rest] = segmentsOf(route);
|
|
434
508
|
return options.locale && first === `[${LOCALE_PARAM}]` ? `/${rest.join("/")}` : route;
|
|
435
509
|
};
|
|
436
|
-
const
|
|
510
|
+
const hyleParam = options.hyleParam ?? "hyle";
|
|
511
|
+
const routes = hostRoutes.map(dropLocale).filter((r) => !isHashedMetadataRoute(r));
|
|
512
|
+
const exact = new Set(routes.filter((r) => !isDynamic(r)));
|
|
437
513
|
const mounts = options.mounts?.filter((m) => m !== "/");
|
|
514
|
+
const onMount = (segment) => mounts?.some((m) => m === `/${segment}` || m.startsWith(`/${segment}/`)) ?? true;
|
|
438
515
|
const groups = /* @__PURE__ */ new Map();
|
|
439
516
|
for (const route of exact) {
|
|
440
517
|
const [first, ...rest] = segmentsOf(route);
|
|
441
518
|
if (first !== void 0 && rest.length > 0) groups.set(first, [...groups.get(first) ?? [], route]);
|
|
442
519
|
}
|
|
520
|
+
const wildcards = /* @__PURE__ */ new Set();
|
|
443
521
|
for (const [first, members] of groups) {
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
522
|
+
if (members.length >= 2 && !onMount(first)) wildcards.add(`/${first}/*`);
|
|
523
|
+
}
|
|
524
|
+
for (const route of routes.filter(isDynamic)) {
|
|
525
|
+
const segments = parse(route);
|
|
526
|
+
const last = segments.at(-1);
|
|
527
|
+
if ((last?.kind === "catch-all" || last?.kind === "optional-catch-all") && last.name === hyleParam) continue;
|
|
528
|
+
const dir = segments.slice(0, segments.findIndex((seg) => seg.kind !== "static")).map((seg) => seg.kind === "static" ? seg.value : "").join("/");
|
|
529
|
+
if (dir === "" || !mounts) continue;
|
|
530
|
+
if (!mounts.some((m) => m === `/${dir}` || m.startsWith(`/${dir}/`))) wildcards.add(`/${dir}/*`);
|
|
449
531
|
}
|
|
450
|
-
|
|
532
|
+
const all = [...exact, ...wildcards];
|
|
533
|
+
const base = (entry) => entry.endsWith("/*") ? entry.slice(0, -2) : entry;
|
|
534
|
+
return all.filter((entry) => !all.some((other) => other !== entry && other.endsWith("/*") && covers(other, base(entry)))).sort();
|
|
451
535
|
}
|
|
452
536
|
function formatReport(report) {
|
|
453
537
|
const lines = [];
|
|
@@ -480,6 +564,7 @@ var printable = (text) => {
|
|
|
480
564
|
CACHE_TAG_PATTERN,
|
|
481
565
|
Cp1ClientError,
|
|
482
566
|
DeliveryDedupe,
|
|
567
|
+
SDK_OWN_RESERVED,
|
|
483
568
|
checkRoutes,
|
|
484
569
|
createHyleClient,
|
|
485
570
|
createRevalidationCallbackRoute,
|
|
@@ -491,5 +576,6 @@ var printable = (text) => {
|
|
|
491
576
|
parseSignatureHeader,
|
|
492
577
|
reservedFor,
|
|
493
578
|
routeMatches,
|
|
579
|
+
syncHostReserved,
|
|
494
580
|
verifyHyleSignature
|
|
495
581
|
});
|