@dogsbay/site-files 0.2.0-beta.143 → 0.2.0-beta.144

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.
@@ -49,6 +49,16 @@ export declare function prefixSlug(prefix: readonly string[], slug: string): str
49
49
  * prefix the importer already wrote into each href.
50
50
  */
51
51
  export declare function prefixNavHrefs<T extends PrefixableNavItem>(items: readonly T[], prefix: readonly string[], basePath: string): T[];
52
+ /**
53
+ * The URL segments that name a product: every source's `name:` when namespaces are active,
54
+ * else none. A root-relative link starting with one already names its product
55
+ * (`/calico/latest/x` on a Calico Enterprise page, `/calico-enterprise/3.22/x` to another
56
+ * version of its own), so `rewriteContentRefs` must leave it alone: pass these with the global
57
+ * prefixes. Before, only taxonomy paths were left alone, and a link into another product became
58
+ * `/calico-enterprise/latest/calico/latest/x`. Importers avoid them as first slug segments
59
+ * (`reservedSlugs`), as they do the source's own prefix.
60
+ */
61
+ export declare function namespacePrefixes(sources: readonly NamespacedSource[]): Set<string>;
52
62
  /**
53
63
  * A named source's nav as it joins the site's sidebar: one group labelled
54
64
  * with the namespace, holding the source's own nav. An unnamed source's nav
@@ -81,6 +81,20 @@ export function prefixNavHrefs(items, prefix, basePath) {
81
81
  return next;
82
82
  });
83
83
  }
84
+ /**
85
+ * The URL segments that name a product: every source's `name:` when namespaces are active,
86
+ * else none. A root-relative link starting with one already names its product
87
+ * (`/calico/latest/x` on a Calico Enterprise page, `/calico-enterprise/3.22/x` to another
88
+ * version of its own), so `rewriteContentRefs` must leave it alone: pass these with the global
89
+ * prefixes. Before, only taxonomy paths were left alone, and a link into another product became
90
+ * `/calico-enterprise/latest/calico/latest/x`. Importers avoid them as first slug segments
91
+ * (`reservedSlugs`), as they do the source's own prefix.
92
+ */
93
+ export function namespacePrefixes(sources) {
94
+ if (!isNamespaceAxisActive(sources))
95
+ return new Set();
96
+ return new Set(sources.map(sourceNamespace).filter((n) => n !== undefined));
97
+ }
84
98
  /**
85
99
  * A named source's nav as it joins the site's sidebar: one group labelled
86
100
  * with the namespace, holding the source's own nav. An unnamed source's nav
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dogsbay/site-files",
3
- "version": "0.2.0-beta.143",
3
+ "version": "0.2.0-beta.144",
4
4
  "description": "robots.txt, _headers, llms.txt, sitemaps, redirects and JSON-LD for docs sites; shared by the dogsbay Astro pipeline and dogsbay-ssg, Worker-safe",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",