@f5-sales-demo/docs-theme 4.4.9 → 4.4.11

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 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
- ...(resolvedLocales ? { redirects: { '/': `${normalizedBase}/${resolvedDefaultLocale}/` } } : {}),
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@f5-sales-demo/docs-theme",
3
- "version": "4.4.9",
3
+ "version": "4.4.11",
4
4
  "description": "F5 Distributed Cloud branded Starlight documentation theme",
5
5
  "type": "module",
6
6
  "engines": {
@@ -79,3 +79,10 @@ describe('localizeEcosystemHref', () => {
79
79
  );
80
80
  });
81
81
  });
82
+
83
+ it('leaves the single-locale mvp menu destination unlocalized', () => {
84
+ for (const locale of ['en', 'fr'])
85
+ expect(localizeEcosystemHref('https://f5-sales-demo.github.io/mvp/', locale)).toBe(
86
+ 'https://f5-sales-demo.github.io/mvp/',
87
+ );
88
+ });
@@ -5,7 +5,7 @@ const ECOSYSTEM_HOST = 'f5-sales-demo.github.io';
5
5
  // Ecosystem sites published as a single locale (no `/<locale>/` path segment).
6
6
  // Injecting a locale slug into links to these produces a 404
7
7
  // (e.g. `/terraform-provider-xcsh/en/`), so they are left unlocalized.
8
- const NON_LOCALIZED_ECOSYSTEM_SLUGS = new Set(['terraform-provider-xcsh', 'docs-control', 'html-to-markdown']);
8
+ const NON_LOCALIZED_ECOSYSTEM_SLUGS = new Set(['terraform-provider-xcsh', 'docs-control', 'html-to-markdown', 'mvp']);
9
9
 
10
10
  export const langToSlug = bcp47ToSlug;
11
11
 
@@ -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
+ }