@f5-sales-demo/docs-theme 4.1.5 → 4.2.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/config.ts +58 -0
- package/package.json +2 -2
package/config.ts
CHANGED
|
@@ -37,6 +37,62 @@ import { buildSubcategorySidebar } from './src/utils/subcategory-sidebar.ts';
|
|
|
37
37
|
export type { LocaleConfig } from './src/i18n/locales.ts';
|
|
38
38
|
export { f5xcDefaultLocales } from './src/i18n/locales.ts';
|
|
39
39
|
|
|
40
|
+
interface ProgressiveCorpusPolicy {
|
|
41
|
+
taxonomy?: {
|
|
42
|
+
levels: ['category', 'subcategory'];
|
|
43
|
+
collapseSingletonSubcategories: boolean;
|
|
44
|
+
};
|
|
45
|
+
hints?: {
|
|
46
|
+
strategy: 'first-sentence';
|
|
47
|
+
maxCharacters: number;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function progressiveCorpusPolicy(config: Record<string, unknown>): ProgressiveCorpusPolicy {
|
|
52
|
+
const value = config.progressiveCorpus;
|
|
53
|
+
if (value === undefined) return {};
|
|
54
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
55
|
+
throw new Error('[docs-theme] progressiveCorpus configuration must be an object');
|
|
56
|
+
}
|
|
57
|
+
const input = value as Record<string, unknown>;
|
|
58
|
+
const policy: ProgressiveCorpusPolicy = {};
|
|
59
|
+
if (input.taxonomy !== undefined) {
|
|
60
|
+
if (!input.taxonomy || typeof input.taxonomy !== 'object' || Array.isArray(input.taxonomy)) {
|
|
61
|
+
throw new Error('[docs-theme] progressiveCorpus taxonomy is invalid');
|
|
62
|
+
}
|
|
63
|
+
const taxonomy = input.taxonomy as Record<string, unknown>;
|
|
64
|
+
const levels = taxonomy.levels;
|
|
65
|
+
if (
|
|
66
|
+
!Array.isArray(levels) ||
|
|
67
|
+
levels.length !== 2 ||
|
|
68
|
+
levels[0] !== 'category' ||
|
|
69
|
+
levels[1] !== 'subcategory' ||
|
|
70
|
+
typeof taxonomy.collapseSingletonSubcategories !== 'boolean'
|
|
71
|
+
) {
|
|
72
|
+
throw new Error('[docs-theme] progressiveCorpus taxonomy is invalid');
|
|
73
|
+
}
|
|
74
|
+
policy.taxonomy = {
|
|
75
|
+
levels: ['category', 'subcategory'],
|
|
76
|
+
collapseSingletonSubcategories: taxonomy.collapseSingletonSubcategories,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
if (input.hints !== undefined) {
|
|
80
|
+
if (!input.hints || typeof input.hints !== 'object' || Array.isArray(input.hints)) {
|
|
81
|
+
throw new Error('[docs-theme] progressiveCorpus hints are invalid');
|
|
82
|
+
}
|
|
83
|
+
const hints = input.hints as Record<string, unknown>;
|
|
84
|
+
if (
|
|
85
|
+
hints.strategy !== 'first-sentence' ||
|
|
86
|
+
!Number.isInteger(hints.maxCharacters) ||
|
|
87
|
+
(hints.maxCharacters as number) < 1
|
|
88
|
+
) {
|
|
89
|
+
throw new Error('[docs-theme] progressiveCorpus hints are invalid');
|
|
90
|
+
}
|
|
91
|
+
policy.hints = { strategy: 'first-sentence', maxCharacters: hints.maxCharacters as number };
|
|
92
|
+
}
|
|
93
|
+
return policy;
|
|
94
|
+
}
|
|
95
|
+
|
|
40
96
|
interface HeadEntry {
|
|
41
97
|
tag: string;
|
|
42
98
|
attrs?: Record<string, string>;
|
|
@@ -633,6 +689,7 @@ export function createF5xcDocsConfig(options: F5xcDocsConfigOptions = {}) {
|
|
|
633
689
|
|
|
634
690
|
const federatedSearch = options.federatedSearch !== false;
|
|
635
691
|
const normalizedBase = base.replace(/\/+$/, '');
|
|
692
|
+
const repositoryCorpusPolicy = progressiveCorpusPolicy(llmsConfig);
|
|
636
693
|
const progressiveCorpus =
|
|
637
694
|
options.progressiveCorpus ||
|
|
638
695
|
(process.env.MACHINE_CORPUS_DIR
|
|
@@ -642,6 +699,7 @@ export function createF5xcDocsConfig(options: F5xcDocsConfigOptions = {}) {
|
|
|
642
699
|
assetBaseUrl: `${normalizedBase}/snapshot/`,
|
|
643
700
|
title,
|
|
644
701
|
description,
|
|
702
|
+
...repositoryCorpusPolicy,
|
|
645
703
|
sources: {
|
|
646
704
|
'docs-cloud-f5-com': {
|
|
647
705
|
title: 'F5 Distributed Cloud Documentation',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@f5-sales-demo/docs-theme",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "F5 Distributed Cloud branded Starlight documentation theme",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
"@anthropic-ai/sdk": "^0.121.0",
|
|
140
140
|
"@astrojs/react": "^6.0.4",
|
|
141
141
|
"@f5-sales-demo/i18n-core": "^1.0.56",
|
|
142
|
-
"@f5-sales-demo/starlight-llms-txt": "2.
|
|
142
|
+
"@f5-sales-demo/starlight-llms-txt": "2.2.0",
|
|
143
143
|
"@f5-sales-demo/starlight-mega-menu": "^3.0.0",
|
|
144
144
|
"gray-matter": "^4.0.3",
|
|
145
145
|
"remark-code-import": "^1.2.0",
|