@f5-sales-demo/docs-theme 4.4.9 → 4.4.10
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 +9 -4
- package/index.ts +0 -1
- package/package.json +1 -1
- package/src/utils/menu-localization.test.ts +15 -0
- package/src/utils/menu-localization.ts +16 -0
package/config.ts
CHANGED
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
import { sidebarTranslations } from './src/i18n/translations.ts';
|
|
33
33
|
import remarkMermaid from './src/plugins/remark-mermaid.mjs';
|
|
34
34
|
import { providerMegaMenu } from './src/utils/canonical-provider.ts';
|
|
35
|
+
import { menuLocalizationPolicy } from './src/utils/menu-localization.ts';
|
|
35
36
|
import { stagedProviderSections } from './src/utils/provider-sections.ts';
|
|
36
37
|
import { resolveMegaMenuIcon } from './src/utils/resolve-icon.ts';
|
|
37
38
|
import providerSharedAssets from './src/utils/share-provider-assets.mjs';
|
|
@@ -670,7 +671,7 @@ export function createF5xcDocsConfig(options: F5xcDocsConfigOptions = {}) {
|
|
|
670
671
|
}
|
|
671
672
|
const site = options.site || process.env.DOCS_SITE || 'https://f5-sales-demo.github.io';
|
|
672
673
|
const base = options.base || process.env.DOCS_BASE || '/';
|
|
673
|
-
const title = options.title || process.env.DOCS_TITLE || 'Documentation';
|
|
674
|
+
const title = options.title || process.env.DOCS_TITLE || (canonicalProvider ? 'Terraform Provider' : 'Documentation');
|
|
674
675
|
const description = options.description || process.env.DOCS_DESCRIPTION || '';
|
|
675
676
|
const githubRepository = options.githubRepository || process.env.GITHUB_REPOSITORY || '';
|
|
676
677
|
let llmsOptionalLinks: Array<{ title: string; url: string }> = options.llmsOptionalLinks || [];
|
|
@@ -716,7 +717,7 @@ export function createF5xcDocsConfig(options: F5xcDocsConfigOptions = {}) {
|
|
|
716
717
|
const megaMenuItems =
|
|
717
718
|
options.megaMenuItems ||
|
|
718
719
|
(canonicalProvider
|
|
719
|
-
? providerMegaMenu(base, stagedProviderSections(canonicalProvider.manifest))
|
|
720
|
+
? [...defaultMegaMenuItems, ...providerMegaMenu(base, stagedProviderSections(canonicalProvider.manifest))]
|
|
720
721
|
: defaultMegaMenuItems);
|
|
721
722
|
const head = options.head || (canonicalProvider ? [] : defaultHead);
|
|
722
723
|
const logo = options.logo || { src: '@f5-sales-demo/docs-theme/assets/f5-distributed-cloud.svg' };
|
|
@@ -874,13 +875,17 @@ export function createF5xcDocsConfig(options: F5xcDocsConfigOptions = {}) {
|
|
|
874
875
|
return defineConfig({
|
|
875
876
|
site,
|
|
876
877
|
base,
|
|
878
|
+
vite: { plugins: [menuLocalizationPolicy()], ...(canonicalProvider ? { build: { assetsInlineLimit: 0 } } : {}) },
|
|
877
879
|
...(canonicalProvider
|
|
878
880
|
? {
|
|
879
881
|
experimental: { collectionStorage: { type: 'chunked' as const, chunkSize: 1024 * 1024 } },
|
|
880
|
-
vite: { build: { assetsInlineLimit: 0 } },
|
|
881
882
|
}
|
|
882
883
|
: {}),
|
|
883
|
-
...(
|
|
884
|
+
...(canonicalProvider
|
|
885
|
+
? { redirects: { '/en/': `${normalizedBase}/` } }
|
|
886
|
+
: resolvedLocales
|
|
887
|
+
? { redirects: { '/': `${normalizedBase}/${resolvedDefaultLocale}/` } }
|
|
888
|
+
: {}),
|
|
884
889
|
markdown: {
|
|
885
890
|
processor: unified({
|
|
886
891
|
remarkPlugins: [remarkMermaid, [codeImport, { allowImportingFromOutside: true }], ...additionalRemarkPlugins],
|
package/index.ts
CHANGED
|
@@ -26,7 +26,6 @@ export default function f5xcDocsTheme(): StarlightPlugin {
|
|
|
26
26
|
...config.components,
|
|
27
27
|
...(process.env.DOCS_PROFILE === 'canonical-provider'
|
|
28
28
|
? {
|
|
29
|
-
Header: '@f5-sales-demo/docs-theme/components/ProviderHeader.astro',
|
|
30
29
|
Sidebar: '@f5-sales-demo/docs-theme/components/ProviderSidebar.astro',
|
|
31
30
|
}
|
|
32
31
|
: {}),
|
package/package.json
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { expect, it } from 'vitest';
|
|
2
|
+
import { menuLocalizationPolicy } from './menu-localization';
|
|
3
|
+
|
|
4
|
+
it('routes archived desktop and mobile menu localization through the theme policy', () => {
|
|
5
|
+
const plugin = menuLocalizationPolicy();
|
|
6
|
+
for (const name of ['MegaMenu.tsx', 'MegaMenuMobile.tsx']) {
|
|
7
|
+
expect(
|
|
8
|
+
plugin.resolveId(
|
|
9
|
+
'../libs/localize-ecosystem-href.ts',
|
|
10
|
+
`/app/node_modules/@f5-sales-demo/starlight-mega-menu/components/${name}`,
|
|
11
|
+
),
|
|
12
|
+
).toMatch(/localize-ecosystem-href\.ts$/);
|
|
13
|
+
}
|
|
14
|
+
expect(plugin.resolveId('../libs/localize-ecosystem-href.ts', '/app/other.ts')).toBeUndefined();
|
|
15
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { fileURLToPath } from 'node:url';
|
|
2
|
+
|
|
3
|
+
// The archived menu package has a separate localizer that blindly adds language
|
|
4
|
+
// paths. Route both its desktop and mobile components through the theme policy.
|
|
5
|
+
export function menuLocalizationPolicy() {
|
|
6
|
+
return {
|
|
7
|
+
name: 'f5-menu-localization-policy',
|
|
8
|
+
enforce: 'pre' as const,
|
|
9
|
+
resolveId(source: string, importer?: string) {
|
|
10
|
+
if (importer?.includes('/starlight-mega-menu/') && /(?:^|\/)localize-ecosystem-href(?:\.ts)?$/.test(source)) {
|
|
11
|
+
return fileURLToPath(new URL('./localize-ecosystem-href.ts', import.meta.url));
|
|
12
|
+
}
|
|
13
|
+
return undefined;
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
}
|