@viteplus/versions 1.0.0 → 2.0.1

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/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- var R=Object.defineProperty;var o=(e,i)=>R(e,"name",{value:i,configurable:!0});import{join as d}from"path";function v(e,i,t){if("items"in e&&e.items&&(e.items=e.items.map(r=>v(r,i,t))),"component"in e&&e.component){let r=e;r.props??={},r.props.versioningPlugin={versions:i,latestVersion:t}}return e}o(v,"addVersioningToNavItem");function b(e,i,t=""){Array.isArray(e.nav)&&(e.nav=e.nav.map(r=>v(r,i,t)))}o(b,"versioningNav");import{xterm as T}from"@remotex-labs/xansi/xterm.component";function u(e,i){for(let t in i){if(t==="__proto__"||t==="constructor"||t==="prototype")continue;let r=i[t],n=e[t];n===void 0?e[t]=r:r&&typeof r=="object"&&n&&typeof n=="object"&&u(n,r)}return e}o(u,"assignMissingDeep");function S(e,i,t="Latest"){if(e.versionSwitcher===!1)return;let r={text:"Switch Version",includeLatestVersion:!0};e.versionSwitcher?u(e.versionSwitcher,r):e.versionSwitcher={...r};let{text:n,includeLatestVersion:a}=e.versionSwitcher,s=[];a&&s.push({text:t==="Latest"?t:`${t} (latest)`,link:"/"});for(let f of i)s.push({text:f,link:`/${f}/`});e.nav??=[],e.nav.push({text:n,items:s})}o(S,"versionSwitcher");import{resolve as k}from"path";import{existsSync as V,readFileSync as $}from"fs";function g(e,i,t){return t.map(r=>(r.skipVersioning||(r.link&&(r.link=e.sidebarUrlProcessor(r.link,i)),r.items&&(r.items=g(e,i,r.items))),r))}o(g,"replaceLinksRecursive");function C(e,i,t,r){let n=k(r,e.sidebarPathResolver(i+(t==="root"?"":`-${t}`)));if(!V(n))return[];let a=JSON.parse($(n,"utf-8"));if(Array.isArray(a))return g(e,(t==="root"?"":`${t}/`)+i,a);let s=a;return Object.keys(s).forEach(f=>{Array.isArray(s[f])&&(s[f]=g(e,(t==="root"?"":`${t}/`)+i,s[f]))}),s}o(C,"loadSidebar");function I(e,i,t,r){let n={},a=e.versioning.sidebarOptions;if(a===!1)return n;for(let s of i)for(let f of t){let p=C(a,s,f,r);Array.isArray(p)?n[(f==="root"?"":`/${f}`)+`/${s}/`]=p:Object.keys(p).forEach(c=>{n[(f==="root"?"":`/${f}`)+`/${s}${c}`]=p[c]})}return n}o(I,"versioningSidebar");function x(e,i,t){let r=[e.themeConfig,...Object.values(e.locales??{}).map(n=>n.themeConfig)];for(let n of r)n&&(S(n,i,e.versioning.latestVersion),b(n,i,e.versioning.latestVersion),Array.isArray(n.sidebar)?console.error(`${T.redBright("[ viteplus ]")} - The sidebar cannot be an array.
2
- `+T.dim("Please use a DefaultTheme.MultiSidebar object where the root ('/') is your array.")):n.sidebar={...n.sidebar,...I(e,i,Object.keys(e.locales??{}),t)})}o(x,"themeConfig");var A={latestVersion:void 0,rewrites:{localePrefix:"",rewriteProcessor:o(e=>e.replace("versions/",""),"rewriteProcessor"),localeRewriteProcessor(e,i,t){return`${t}/`+e.replace("versions/","").replace(`${t}/`,"")}},sidebarOptions:{processSidebarURLs:!0,sidebarPathResolver:o(e=>`.vitepress/sidebars/versioned/${e}.json`,"sidebarPathResolver"),sidebarUrlProcessor:o((e,i)=>`/${i}${e}`,"sidebarUrlProcessor")}};import{posix as l}from"path";import{existsSync as j,readdirSync as O}from"fs";function y(e,i){let t=[];for(let r of O(e,{withFileTypes:!0})){let n=l.join(e,r.name);if(r.isDirectory()){if(i.includes(r.name))continue;t.push(...y(n,i))}else t.push(n)}return t}o(y,"collectFilesRecursively");function N(e,i,t,r=[]){let n={};if(e===!1)return n;let a=l.join(i,"versions");for(let s of t){let f=l.join(a,s),p=y(f,r);for(let c of p){let m=c.replace(a,"versions");n[m]=e.rewriteProcessor(m,s)}for(let c of r){let m=l.join(a,s,e.localePrefix,c);if(!j(m))continue;let w=y(m,r);for(let P of w){let h=P.replace(a,"versions");n[h]=e.localeRewriteProcessor?.(h,s,c).replace(`/${e.localePrefix}`,"")??""}}}return n}o(N,"generateVersionedUrls");function D(e,i,t){e.rewrites={...e.rewrites,...N(e.versioning.rewrites,t,i,Object.keys(e.locales??{}))}}o(D,"versionRoutes");import{existsSync as L,mkdirSync as M,readdirSync as F,writeFileSync as U}from"fs";function ye(e){let i=d(process.cwd(),e.root),t=d(i,e.srcDir??""),r=d(t,"versions");L(r)||(M(r),U(d(r,".gitkeep"),""));let n=F(r,{withFileTypes:!0}).filter(a=>a.isDirectory()).map(a=>a.name);return e.versioning=u(e.versioning,A),x(e,n,i),D(e,n,t),e}o(ye,"defineVersionedConfig");export{ye as defineVersionedConfig};
1
+ var b=Object.defineProperty;var W=Object.getOwnPropertyDescriptor;var s=(e,o)=>b(e,"name",{value:o,configurable:!0});var T=(e,o,r,t)=>{for(var n=t>1?void 0:t?W(o,r):o,i=e.length-1,a;i>=0;i--)(a=e[i])&&(n=(t?a(o,r,n):a(n))||n);return t&&n&&b(o,r,n),n};import{join as m,posix as B}from"path";import{xterm as G}from"@remotex-labs/xansi/xterm.component";var y=new Map,k=new Map;function $(e){return typeof e=="object"&&e!==null&&"useClass"in e}s($,"isProviderUseClass");function E(e){return typeof e=="object"&&e!==null&&"useFactory"in e}s(E,"isProviderUseFactory");function z(e){return typeof e=="object"&&e!==null&&"useValue"in e}s(z,"isProviderUseValue");function I(e){return function(o){k.set(o,e||{})}}s(I,"Injectable");function v(e,o=[]){if(!e)return o;let r=o;for(let t of e.slice(r.length))if($(t))r.push(p(t.useClass,...v(t.providers)));else if(E(t))r.push(t.useFactory(...v(t.providers)));else if(z(t))r.push(t.useValue);else if(typeof t=="function")r.push(p(t));else throw new Error(`Unknown provider type: ${typeof t}`);return r}s(v,"providersIntoArgs");function p(e,...o){if(y.has(e))return y.get(e);let r=k.get(e);if(!r)throw new Error(`Cannot inject ${e.name} \u2013 not marked @Injectable`);let t=v(r.providers,o),n=r.factory?r.factory(...t):new e(...t);return r?.scope==="singleton"&&y.set(e,n),n}s(p,"inject");function j(e,...o){return y.has(e)&&y.delete(e),p(e,...o)}s(j,"forceInject");import{existsSync as S,mkdirSync as J,readdirSync as q,writeFileSync as Q}from"fs";import{join as x}from"path/posix";function A(e,o,r){return x(r,o,e)}s(A,"rewritesHook");function w(){let e={},o=p(f),r=Object.keys(o.localesMap);for(let[t,n]of Object.entries(o.fileMap)){let i=t===""?o.sources:o.archive;for(let a of n){let c=r[r.findIndex(g=>a.startsWith(g))],l=o.localesMap[c]==="root"?"":c??"";e[x(i,t,a)]=o.versionsConfig.hooks.rewritesHook(a.replace(c+"/",""),t,l)}}o.vitepressConfig.rewrites=e}s(w,"parseRoutesComponent");var h={locales:{},rewrites:{},versionsConfig:{current:"latest",sources:"src",archive:"archive",hooks:{rewritesHook:A},versionSwitcher:{text:"Switch Version",includeCurrentVersion:!0}}};import{readdirSync as D}from"fs";import{join as H,relative as K}from"path/posix";function C(e,o){let r={...e};for(let t in o)if(Object.prototype.hasOwnProperty.call(o,t)){let n=o[t],i=e[t];i&&typeof i=="object"&&n&&typeof n=="object"&&!Array.isArray(n)&&!Array.isArray(n)?r[t]=C(i,n):r[t]=n}return r}s(C,"deepMerge");function d(e,o=e){let r=[],t=D(o,{withFileTypes:!0});for(let n of t){let i=H(o,n.name);if(n.isDirectory())r=r.concat(d(e,i));else if(n.isFile()&&n.name.endsWith(".md")){let a=K(e,i);r.push(a)}}return r}s(d,"getAllMarkdownFilesRelative");var f=class{constructor(o=h){this.configuration=o;let{sources:r,archive:t}=o.versionsConfig;if(this.sources=r,this.archive=t,this.versionsConfig=o.versionsConfig,this.root=m(process.cwd(),process.argv[3]??"",o.srcDir??""),this.sourcesPath=m(this.root,this.sources),this.archivePath=m(this.root,this.archive),!S(this.sourcesPath))throw console.error(G.red("[ viteplus ]"),`Source directory ${this.sourcesPath} does not exist
2
+ `),new Error(`Source directory ${this.sourcesPath} does not exist`);this.makeArchiveDirectory(this.archivePath),this.vitepressConfig=this.createVitepressConfig()}root;sources;archive;sourcesPath;archivePath;versionsConfig;vitepressConfig;versionsList=[];localesMap={};fileMap={};init(){let o=q(this.archivePath,{withFileTypes:!0}).filter(r=>r.isDirectory());this.fileMap[""]=d(this.sourcesPath),this.vitepressConfig.locales.root={themeConfig:{}};for(let r of o){let t=m(r.parentPath,r.name);this.fileMap[r.name]=d(t)}return this.initializeLocalesMap(),this}initializeLocalesMap(){let o=this.vitepressConfig.locales,r=this.configuration.locales;if(this.versionsList.push(...Object.keys(this.fileMap).filter(Boolean)),o.root={},Object.keys(r).length>0){let t=Object.keys(r),n="root"in r?"root":t[0];for(let i of t){let a=r[i].lang??i;for(let c of this.versionsList){if(i===n)continue;let l=B.join(a,c);o[l]={}}i===n?this.localesMap[r[i].link??a]="root":(o[i]={},this.localesMap[r[i].link??a]=i)}}for(let t of this.versionsList)o[t]={}}makeArchiveDirectory(o){o&&(S(o)||(J(o),Q(m(o,".gitkeep"),"")))}createVitepressConfig(){let o={},r=["locales","rewrites","themeConfig","versionsConfig"];for(let t of Object.keys(this.configuration))if(!r.includes(t))o[t]=this.configuration[t];else if(t==="themeConfig"){let n=this.configuration.themeConfig??{};o.themeConfig=Object.fromEntries(Object.entries(n).filter(([i])=>i!=="nav"&&i!=="sidebar"))}else t!=="versionsConfig"&&(o[t]={});return o}};s(f,"StateModel"),f=T([I({scope:"singleton"})],f);import{join as P}from"path/posix";function O(e,o,r="Latest"){if(e.versionSwitcher===!1)return;let{text:t,includeCurrentVersion:n}=e.versionSwitcher,i=[];n&&i.push({link:"/",text:r==="Latest"?r:`${r} (latest)`,skipVersioning:!0});for(let a of o)i.push({text:a,link:`/${a}/`,skipVersioning:!0});return{text:t,items:i}}s(O,"versionSwitcher");function X(e){return"items"in e&&Array.isArray(e.items)}s(X,"isNavItemWithChildren");function Y(e){return"link"in e&&!!e.link}s(Y,"isNavItemWithLink");function L(e,o){return X(o)&&!o.skipVersioning?{...o,items:o.items.map(r=>L(e,r))}:Y(o)&&!o.skipVersioning?{...o,link:P("/",e,o.link)}:o}s(L,"replaceLinksRecursive");function Z(e,o){let r=p(f);return o==="root"&&(o=""),e.map(t=>"component"in t&&t.component?{...t,props:{...t.props,versioningPlugin:{versions:r.versionsList,currentVersion:r.versionsConfig.current}}}:L(o,t))}s(Z,"populateNav");function N(e,o,r="",t={}){if(Array.isArray(o)){let n=r||"root";e[n]??=[],e[n].push(...o),t[n]?e[n].push(...t[n]):t.root&&e[n].push(...t.root);return}for(let[n,i]of Object.entries(o)){let c=n==="root"?n==="root"&&r===""?"root":r:P(r,n);e[c]??=[],e[c].push(...i),t[n]?e[c].push(...t[n]):t.root&&e[c].push(...t.root)}}s(N,"normalizeNav");function _(e){let o=e.configuration.locales,r=Object.keys(o),t={root:[]};e.configuration.themeConfig?.nav&&N(t,e.configuration.themeConfig.nav);let n=O(e.versionsConfig,e.versionsList,e.versionsConfig.current);if(n&&t.root.push(n),!r.length)return t;let i={root:[]};for(let a of r){let c=a==="root"||e.localesMap[a]==="root"?"root":a;N(i,o[a].themeConfig?.nav??[],c,t)}return i}s(_,"normalizeNavs");function V(){let e=p(f),{vitepressConfig:{locales:o}}=e,r=_(e);for(let[t,n]of Object.entries(o)){let i=r[t]??r.root;n.themeConfig??={},n.themeConfig.nav=Z(i,t)}}s(V,"parseNavs");import{join as ee}from"path/posix";function M(){let e=p(f),o=e.versionsList,r=e.vitepressConfig.locales,t=e.configuration.locales;for(let n of Object.keys(e.localesMap)){let i=e.localesMap[n],a=i==="root",l={..."root"in t?t[i]:t[n],themeConfig:void 0};r[i]??={},Object.assign(r[i],l),a?r[i].link="/":r[i].link=`/${r[i].lang}/`;for(let g of o){let u=a?g:ee(n,g);r[u]??={},Object.assign(r[u],{...l}),r[u].label=" ",a?r[u].link="/":r[u].link=`/${r[u].lang}/`}}}s(M,"parseLocale");import{join as U}from"path/posix";function re(e,o){return o==="root"&&(o=""),e.map(r=>(r.skipVersioning||(r={...r},(r.link||r.items)&&o!==""&&(r.base??="",r.base=U("/",o,r.base,"/"))),r))}s(re,"populateSidebar");function R(e,o,r="",t={}){if(Array.isArray(o)){let n=r||"root";e[n]??=[],t[n]?e[n].push(...t[n]):t.root&&e[n].push(...t.root),e[n].push(...o);return}for(let[n,i]of Object.entries(o)){let c=n==="root"?n==="root"&&r===""?"root":r:U(r,n),l=Array.isArray(i)?i:[i];e[c]??=[],t[n]?e[c].push(...t[n]):t.root&&e[c].push(...t.root),e[c].push(...l)}}s(R,"normalizeSidebar");function oe(e){let o=e.configuration.locales,r=Object.keys(o),t={root:[]};if(e.configuration.themeConfig?.sidebar&&R(t,e.configuration.themeConfig.sidebar),!r.length)return t;let n={root:[]};for(let i of r){let a=i==="root"||e.localesMap[i]==="root"?"root":i;R(n,o[i].themeConfig?.sidebar??[],a,t)}return n}s(oe,"normalizeSidebars");function F(){let e=p(f),{vitepressConfig:{locales:o}}=e,r=oe(e);for(let[t,n]of Object.entries(o)){let i=r[t]??r.root;n.themeConfig??={},n.themeConfig.sidebar=re(i,t)}}s(F,"parseSidebar");function Ye(e){let o=C(h,e),r=j(f,o).init();return M(),V(),F(),w(),r.vitepressConfig}s(Ye,"defineVersionedConfig");export{Ye as defineVersionedConfig};
3
3
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/index.ts", "../src/components/nav.component.ts", "../src/providers/theme.provider.ts", "../src/components/object.component.ts", "../src/components/switcher.component.ts", "../src/components/sidebar.component.ts", "../src/constants/default.constant.ts", "../src/components/routes.component.ts"],
4
- "sourceRoot": "https://github.com/viteplus/versions/tree/v1.0.0/",
5
- "sourcesContent": ["/**\n * Import will remove at compile time\n */\n\nimport type { Dirent } from 'fs';\nimport type { UserConfig } from 'vitepress';\nimport type { ConfigInterface, VersionThemeInterface } from '@interfaces/config.interface';\n\n/**\n * Imports\n */\n\nimport { join } from 'path';\nimport { themeConfig } from '@providers/theme.provider';\nimport { defaultConfig } from './constants/default.constant';\nimport { versionRoutes } from '@components/routes.component';\nimport { assignMissingDeep } from '@components/object.component';\nimport { existsSync, mkdirSync, readdirSync, writeFileSync } from 'fs';\n\n/**\n * Exports\n */\n\nexport * from './interfaces/config.interface';\n\n/**\n * Defines a versioned configuration for a VitePress project.\n *\n * This function sets up the necessary folder structure for versioned documentation,\n * merges default configuration values with the provided config, and initializes\n * theme and routing for versioned documentation.\n *\n * @template T - Type extending {@link VersionThemeInterface}, used for theme configuration.\n *\n * @param config - The user-defined configuration object.\n * @returns UserConfig - The finalized configuration object ready for VitePress.\n *\n * @remarks\n * The function performs the following steps:\n * 1. Resolves the absolute paths for the project root, documentation source folder, and versions folder.\n * 2. Creates the `versions` folder if it doesn't exist and adds a `.gitkeep` file.\n * 3. Reads all directories inside the `versions` folder to determine available versions.\n * 4. Merges user-provided versioning configuration with the default values.\n * 5. Initializes theme settings via {@link themeConfig}.\n * 6. Initializes version-based routes via {@link versionRoutes}.\n *\n * @example\n * ```ts\n * import { defineVersionedConfig } from './config';\n *\n * export default defineVersionedConfig({\n * root: '.',\n * srcDir: 'docs',\n * versioning: { enabled: true },\n * theme: { colorMode: 'dark' }\n * });\n * ```\n *\n * @since 1.0.0\n */\n\nexport function defineVersionedConfig<T extends VersionThemeInterface = VersionThemeInterface>(config: ConfigInterface<T>): UserConfig<T> {\n const rootPath = join(process.cwd(), config.root);\n const docsPath = join(rootPath, config.srcDir ?? '');\n const versionsFolder = join(docsPath, 'versions');\n\n if (!existsSync(versionsFolder)) {\n mkdirSync(versionsFolder);\n writeFileSync(join(versionsFolder, '.gitkeep'), '');\n }\n\n const versions: string[] = readdirSync(versionsFolder, { withFileTypes: true })\n .filter((entry: Dirent) => entry.isDirectory())\n .map((entry: Dirent) => entry.name);\n\n config.versioning = <ConfigInterface['versioning']> assignMissingDeep(config.versioning, defaultConfig);\n themeConfig(config, versions, rootPath);\n versionRoutes(config, versions, docsPath);\n\n return config;\n}\n", "/**\n * Import will remove at compile time\n */\n\nimport type { DefaultTheme } from 'vitepress';\nimport type { VersionThemeInterface } from '@interfaces/config.interface';\n\n/**\n * Recursively adds versioning information to a navigation item.\n *\n * @param navItem - A navigation item to which versioning information will be added.\n * @param versions - An array of available documentation versions.\n * @param latestVersion - The latest version string to mark as the default/latest.\n *\n * @returns The updated navigation item with versioning plugin props applied.\n *\n * @remarks\n * - If the `navItem` has nested `items`, the function recursively updates them.\n * - If the `navItem` has a `component` property, a `versioningPlugin` prop is added\n * containing `versions` and `latestVersion`.\n *\n * @example\n * ```ts\n * import { addVersioningToNavItem } from './nav';\n *\n * const navItemWithVersioning = addVersioningToNavItem(navItem, ['1.0.0', '2.0.0'], '2.0.0');\n * ```\n *\n * @since 1.0.0\n */\n\nexport function addVersioningToNavItem(navItem: DefaultTheme.NavItem, versions: Array<string>, latestVersion: string): DefaultTheme.NavItem {\n if ('items' in navItem && navItem.items) {\n navItem.items = navItem.items.map((item) =>\n addVersioningToNavItem(item, versions, latestVersion)\n ) as Array<DefaultTheme.NavItemWithLink | DefaultTheme.NavItemChildren>;\n }\n\n if ('component' in navItem && navItem.component) {\n const componentItem = navItem as DefaultTheme.NavItem & {\n component: string;\n props?: Record<string, unknown>;\n };\n\n componentItem.props ??= {};\n componentItem.props.versioningPlugin = {\n versions,\n latestVersion\n };\n }\n\n return navItem;\n}\n\n/**\n * Applies versioning to all navigation items in a theme configuration.\n *\n * @param themeConfig - Theme configuration object containing the `nav` array.\n * @param versions - An array of available documentation versions.\n * @param latestVersion - The latest version string to mark as default/latest.\n *\n * @returns void\n *\n * @remarks\n * - Iterates through all `nav` items and applies {@link addVersioningToNavItem}.\n * - Skips processing if `themeConfig.nav` is not an array.\n *\n * @example\n * ```ts\n * import { versioningNav } from './nav';\n *\n * versioningNav(themeConfig, ['1.0.0', '2.0.0'], '2.0.0');\n * ```\n *\n * @since 1.0.0\n */\n\nexport function versioningNav(themeConfig: VersionThemeInterface, versions: Array<string>, latestVersion: string = ''): void {\n if (!Array.isArray(themeConfig.nav)) return;\n\n themeConfig.nav = themeConfig.nav.map((item) =>\n addVersioningToNavItem(item, versions, latestVersion)\n );\n}\n", "/**\n * Import will remove at compile time\n */\n\nimport type { ConfigInterface, VersionThemeInterface } from '@interfaces/config.interface';\n\n/**\n * Imports\n */\n\nimport { versioningNav } from '@components/nav.component';\nimport { xterm } from '@remotex-labs/xansi/xterm.component';\nimport { versionSwitcher } from '@components/switcher.component';\nimport { versioningSidebar } from '@components/sidebar.component';\n\n/**\n * Configures the VitePress theme for versioned documentation.\n *\n * This function applies versioning to the theme, including the version switcher,\n * navigation, and sidebar, for both the default locale and any additional locales.\n *\n * @template T - Type extending {@link VersionThemeInterface}, used for theme configuration.\n *\n * @param config - The configuration object containing theme and versioning settings.\n * @param versions - An array of version strings detected from the `versions` folder.\n * @param rootPath - The absolute path to the project root.\n *\n * @remarks\n * For each theme configuration (default + locales):\n * 1. Initializes the version switcher via {@link versionSwitcher} using `versions` and `config.versioning.latestVersion`.\n * 2. Updates the navigation menu using {@link versioningNav}.\n * 3. Validates the sidebar configuration:\n * - If the sidebar is an array, logs an error recommending a `DefaultTheme.MultiSidebar` object instead.\n * - Otherwise, merges versioned sidebar options via {@link versioningSidebar}.\n *\n * The `themeConfig` function ensures all theme-related versioning features are applied consistently\n * across locales and prevents invalid sidebar structures.\n *\n * @example\n * ```ts\n * import { themeConfig } from './theme';\n *\n * themeConfig(config, ['1.0.0', '2.0.0'], '/path/to/project');\n * ```\n *\n * @since 1.0.0\n */\n\nexport function themeConfig<T extends VersionThemeInterface>(config: ConfigInterface<T>, versions: Array<string>, rootPath: string): void {\n const themeConfigArray = [\n config.themeConfig, ...Object.values(config.locales ?? {}).map(\n (locale) => locale.themeConfig\n )\n ];\n\n for (const themeConfig of themeConfigArray) {\n if (!themeConfig) continue;\n versionSwitcher(themeConfig, versions, config.versioning.latestVersion);\n versioningNav(themeConfig, versions, config.versioning.latestVersion);\n\n if(Array.isArray(themeConfig.sidebar)) {\n console.error(\n `${ xterm.redBright('[ viteplus ]') } - The sidebar cannot be an array.\\n` +\n xterm.dim('Please use a DefaultTheme.MultiSidebar object where the root (\\'/\\') is your array.')\n );\n } else {\n themeConfig.sidebar = {\n ...themeConfig.sidebar,\n ...versioningSidebar(config, versions, Object.keys(config.locales ?? {}), rootPath)\n };\n }\n }\n}\n", "/**\n * Recursively assigns missing properties from a source object to a target object.\n *\n * @param target - The target object that will receive missing properties.\n * @param source - The source object providing default properties.\n *\n * @returns The updated target object with missing properties filled from the source.\n *\n * @remarks\n * - Only properties that are `undefined` in the target will be assigned from the source.\n * - If both target and source values are objects, the function recursively merges missing properties.\n * - Does not overwrite existing properties in the target.\n *\n * @example\n * ```ts\n * const target = { a: 1, b: { x: 10 } };\n * const source = { b: { x: 20, y: 30 }, c: 3 };\n *\n * assignMissingDeep(target, source);\n * // Result: { a: 1, b: { x: 10, y: 30 }, c: 3 }\n * ```\n *\n * @since 1.0.0\n */\n\nexport function assignMissingDeep(\n target: Record<string, unknown>, source: Record<string, unknown>\n): Record<string, unknown> {\n for (const key in source) {\n // Prevent prototype pollution\n if (key === '__proto__' || key === 'constructor' || key === 'prototype') {\n continue;\n }\n\n const sourceValue = source[key];\n const targetValue = target[key];\n\n if (targetValue === undefined) {\n target[key] = sourceValue;\n } else if (\n sourceValue && typeof sourceValue === 'object' &&\n targetValue && typeof targetValue === 'object'\n ) {\n assignMissingDeep(\n targetValue as Record<string, unknown>,\n sourceValue as Record<string, unknown>\n );\n }\n }\n\n return target;\n}\n", "/**\n * Import will remove at compile time\n */\n\nimport type { DefaultTheme } from 'vitepress';\nimport type { VersionThemeInterface } from '@interfaces/config.interface';\n\n/**\n * Imports\n */\n\nimport { assignMissingDeep } from '@components/object.component';\n\n/**\n * Adds a version-switching dropdown to the VitePress navigation.\n *\n * @remarks\n * This utility augments the provided {@link VersionThemeInterface | themeConfig}\n * with a `nav` entry that lists available documentation versions.\n *\n * - If `themeConfig.versionSwitcher` is `false`, the function exits without changes.\n * - If `themeConfig.versionSwitcher` is an object, missing keys are filled using {@link assignMissingDeep}.\n *\n * @param themeConfig - The mutable VitePress theme configuration that will receive the version switcher.\n * @param versions - Array of version strings (e.g., `['v1', 'v2']`) to display as selectable links.\n * @param latestVersion - Optional label for the latest version entry. Defaults to `'Latest'`.\n *\n * @example\n * ```ts\n * versionSwitcher(themeConfig, ['v1', 'v2']);\n * // Adds a nav dropdown titled \"Switch Version\" with entries:\n * // \u2192 Latest\n * // \u2192 v1\n * // \u2192 v2\n * ```\n *\n * @since 1.0.0\n */\n\nexport function versionSwitcher(themeConfig: VersionThemeInterface, versions: Array<string>, latestVersion: string = 'Latest'): void {\n if (themeConfig.versionSwitcher === false) return;\n const defaults = { text: 'Switch Version', includeLatestVersion: true };\n\n if (!themeConfig.versionSwitcher) {\n themeConfig.versionSwitcher = { ...defaults };\n } else {\n assignMissingDeep(themeConfig.versionSwitcher, defaults);\n }\n\n const { text, includeLatestVersion } = themeConfig.versionSwitcher;\n const items: DefaultTheme.NavItemWithLink[] = [];\n if (includeLatestVersion) {\n items.push({\n text: latestVersion === 'Latest' ? latestVersion : `${ latestVersion } (latest)`,\n link: '/'\n });\n }\n\n for (const version of versions) {\n items.push({ text: version, link: `/${ version }/` });\n }\n\n themeConfig.nav ??= [];\n themeConfig.nav.push({ text, items });\n}\n", "/**\n * Import will remove at compile time\n */\n\nimport type { DefaultTheme } from 'vitepress';\nimport type { ConfigInterface, SidebarItemInterface, SidebarOptionsInterface } from '@interfaces/config.interface';\n\n/**\n * Imports\n */\n\nimport { resolve } from 'path';\nimport { existsSync, readFileSync } from 'fs';\n\n/**\n * Recursively replaces sidebar links for a given version using a custom URL processor.\n *\n * @param sidebarOptions - Sidebar options containing the `sidebarUrlProcessor` function.\n * @param version - The current documentation version to apply in the links.\n * @param sidebar - An array of sidebar items to process.\n *\n * @returns A new array of sidebar items with versioned links applied.\n *\n * @remarks\n * - Skips items marked with `skipVersioning`.\n * - Recursively processes nested items under `items`.\n *\n * @example\n * ```ts\n * const updatedSidebar = replaceLinksRecursive(sidebarOptions, '1.0.0', sidebar);\n * ```\n *\n * @since 1.0.0\n */\n\nexport function replaceLinksRecursive(\n sidebarOptions: SidebarOptionsInterface, version: string, sidebar: Array<SidebarItemInterface>\n): Array<SidebarItemInterface> {\n return sidebar.map((item) => {\n if (item.skipVersioning) {\n return item;\n }\n\n if (item.link) {\n item.link = sidebarOptions.sidebarUrlProcessor!(item.link, version);\n }\n\n if (item.items) {\n item.items = replaceLinksRecursive(sidebarOptions, version, item.items);\n }\n\n return item;\n });\n}\n\n/**\n * Loads a sidebar for a specific version and locale from the filesystem.\n *\n * @param sidebarOptions - Sidebar options including `sidebarPathResolver`.\n * @param version - The current documentation version.\n * @param locale - The locale key ('root' for default locale).\n * @param rootPath - Absolute path to the project root.\n *\n * @returns A `DefaultTheme.Sidebar` object (array or multi-sidebar) with versioned links.\n *\n * @remarks\n * - If the sidebar file does not exist, returns an empty array.\n * - Recursively applies `replaceLinksRecursive` for versioned links.\n * - Supports both single-array sidebars and multi-sidebar objects.\n *\n * @example\n * ```ts\n * const sidebar = loadSidebar(sidebarOptions, '1.0.0', 'en', '/path/to/project');\n * ```\n *\n * @since 1.0.0\n */\n\nexport function loadSidebar(sidebarOptions: SidebarOptionsInterface, version: string, locale: string, rootPath: string): DefaultTheme.Sidebar {\n const sidebarPath = resolve(\n rootPath,\n sidebarOptions.sidebarPathResolver!(\n version + (locale === 'root' ? '' : `-${ locale }`)\n )\n );\n\n if (!existsSync(sidebarPath)) return [];\n const sidebar = JSON.parse(readFileSync(sidebarPath, 'utf-8'));\n if (Array.isArray(sidebar)) {\n return replaceLinksRecursive(\n sidebarOptions,\n (locale === 'root' ? '' : `${ locale }/`) + version,\n sidebar\n );\n }\n\n const multiSidebar = sidebar as DefaultTheme.SidebarMulti;\n Object.keys(multiSidebar).forEach((key) => {\n if (Array.isArray(multiSidebar[key])) {\n multiSidebar[key] = replaceLinksRecursive(\n sidebarOptions,\n (locale === 'root' ? '' : `${ locale }/`) + version,\n multiSidebar[key] as Array<SidebarItemInterface>\n );\n }\n });\n\n return multiSidebar;\n}\n\n/**\n * Generates versioned sidebars for all versions and locales.\n *\n * @param config - The configuration object containing versioning and sidebar settings.\n * @param versions - An array of available documentation versions.\n * @param locales - An array of locale keys including `'root'`. If empty, `'root'` will be used.\n * @param rootPath - Absolute path to the project root.\n *\n * @returns A `DefaultTheme.SidebarMulti` object mapping versioned paths to sidebars.\n *\n * @remarks\n * - Iterates through all versions and locales to load and process sidebars.\n * - Uses {@link loadSidebar} to read the sidebar JSON and convert links to versioned URLs.\n * - Handles both single-array sidebars and multi-sidebar objects.\n * - All sidebar links are converted to **absolute paths** relative to the version root to prevent duplicated folder segments in nested paths.\n * - If `config.versioning.sidebarOptions` is `false`, returns an empty sidebar mapping.\n * - Defaults to `'root'` locale if no locales are specified.\n *\n * @example\n * ```ts\n * const sidebars = versioningSidebar(config, ['1.0.0', '2.0.0'], ['root', 'en'], '/path/to/project');\n * // sidebars['/1.0.0/'] \u2192 sidebar for root locale, version 1.0.0\n * // sidebars['/en/1.0.0/'] \u2192 sidebar for 'en' locale, version 1.0.0\n * ```\n *\n * @since 1.0.0\n */\n\nexport function versioningSidebar(\n config: ConfigInterface, versions: Array<string>, locales: Array<string>, rootPath: string\n): DefaultTheme.SidebarMulti {\n const versionSidebars: DefaultTheme.SidebarMulti = {};\n const sidebarOptions = config.versioning.sidebarOptions!;\n if (sidebarOptions === false) return versionSidebars;\n\n for (const version of versions) {\n for (const locale of locales) {\n const sidebar = loadSidebar(sidebarOptions, version, locale, rootPath);\n\n if (Array.isArray(sidebar)) {\n versionSidebars[\n (locale === 'root' ? '' : `/${ locale }`) + `/${ version }/`\n ] = sidebar;\n } else {\n Object.keys(sidebar).forEach((key) => {\n versionSidebars[\n (locale === 'root' ? '' : `/${ locale }`) + `/${ version }${ key }`\n ] = (sidebar as DefaultTheme.SidebarMulti)[key];\n });\n }\n }\n }\n\n return versionSidebars;\n}\n", "/**\n * Import will remove at compile time\n */\n\nimport type { ConfigInterface } from '@interfaces/config.interface';\n\n/**\n * Default versioning configuration.\n *\n * @remarks\n * This object provides the default settings for versioned documentation,\n * including the latest version, URL rewrites, and sidebar options.\n *\n * - `latestVersion`: Initially `undefined`; can be set to mark the most recent version.\n * - `rewrites`: Functions and prefix used to generate versioned URLs for documents.\n * - `localePrefix`: Prefix for locale-specific URLs.\n * - `rewriteProcessor`: Processes file paths for versioned URLs.\n * - `localeRewriteProcessor`: Processes locale-specific versioned URLs.\n * - `sidebarOptions`: Configuration for generating versioned sidebars.\n * - `processSidebarURLs`: Whether sidebar URLs should be processed.\n * - `sidebarPathResolver`: Resolves the path to the sidebar JSON file for a given version.\n * - `sidebarUrlProcessor`: Processes sidebar item URLs to include the version prefix.\n *\n * @example\n * ```ts\n * import { defaultConfig } from './default.constant';\n *\n * console.log(defaultConfig.sidebarOptions.sidebarPathResolver('1.0.0'));\n * // Output: \".vitepress/sidebars/versioned/1.0.0.json\"\n *\n * console.log(defaultConfig.rewrites.rewriteProcessor('versions/guide.md'));\n * // Output: \"guide.md\"\n * ```\n *\n * @since 1.0.0\n */\n\nexport const defaultConfig: Required<ConfigInterface['versioning']> = {\n latestVersion: undefined,\n rewrites: {\n localePrefix: '',\n rewriteProcessor: (inputFilePath: string) => inputFilePath.replace('versions/', ''),\n localeRewriteProcessor(inputFilePath: string, _version: string, locale: string): string {\n return `${ locale }/` + inputFilePath.replace(\n 'versions/', '').replace(`${ locale }/`, ''\n );\n }\n },\n sidebarOptions: {\n processSidebarURLs: true,\n sidebarPathResolver: (version: string) => `.vitepress/sidebars/versioned/${ version }.json`,\n sidebarUrlProcessor: (url: string, version: string) => `/${ version }${ url }`\n }\n};\n", "/**\n * Import will remove at compile time\n */\n\nimport type { ConfigInterface, RewritesOptionsInterface } from '@interfaces/config.interface';\n\n/**\n * Imports\n */\n\nimport { posix } from 'path';\nimport { existsSync, readdirSync } from 'fs';\n\n/**\n * Recursively collects all file paths from a directory, skipping locale folders.\n *\n * @param dirPath - The directory path to scan.\n * @param locales - An array of locale folder names to skip.\n *\n * @returns An array of file paths found recursively under `dirPath`.\n *\n * @remarks\n * - Skips any directories that match names in the `locales` array.\n * - Uses POSIX-style paths for consistency across platforms.\n *\n * @example\n * ```ts\n * const files = collectFilesRecursively('/docs/versions/1.0.0', ['en', 'fr']);\n * ```\n *\n * @since 1.0.0\n */\n\nexport function collectFilesRecursively(dirPath: string, locales: Array<string>): Array<string> {\n const files: string[] = [];\n\n for (const entry of readdirSync(dirPath, { withFileTypes: true })) {\n const fullPath = posix.join(dirPath, entry.name);\n\n if (entry.isDirectory()) {\n if (locales.includes(entry.name)) continue;\n files.push(...collectFilesRecursively(fullPath, locales));\n } else {\n files.push(fullPath);\n }\n }\n\n return files;\n}\n\n/**\n * Generates versioned URL mappings for documentation files.\n *\n * @param rewrites - Rewrites options or `false` to disable URL generation.\n * @param docPath - The root path to the documentation folder.\n * @param versions - An array of documentation versions.\n * @param locales - Optional array of locales to include in URL generation.\n *\n * @returns A record mapping original file paths to their versioned URLs.\n *\n * @remarks\n * - Iterates through each version folder and collects all files.\n * - Applies `rewriteProcessor` and optionally `localeRewriteProcessor` to generate versioned paths.\n * - Locale files are prefixed with `rewrites.localePrefix` and cleaned up for the final path.\n *\n * @example\n * ```ts\n * const urls = generateVersionedUrls(rewrites, '/docs', ['1.0.0', '2.0.0'], ['en', 'fr']);\n * ```\n *\n * @since 1.0.0\n */\n\nexport function generateVersionedUrls(\n rewrites: RewritesOptionsInterface | false, docPath: string, versions: Array<string>, locales: Array<string> = []\n): Record<string, string> {\n const versionedUrls: Record<string, string> = {};\n if (rewrites === false) return versionedUrls;\n\n const versionsDir = posix.join(docPath, 'versions');\n for (const version of versions) {\n const versionPath = posix.join(versionsDir, version);\n\n // Collect all files in this version folder\n const files = collectFilesRecursively(versionPath, locales);\n\n for (const filePath of files) {\n const sourcePath = filePath.replace(versionsDir, 'versions');\n versionedUrls[sourcePath] = rewrites.rewriteProcessor!(\n sourcePath,\n version\n );\n }\n\n for (const locale of locales) {\n const localeDir = posix.join(\n versionsDir,\n version,\n rewrites.localePrefix!,\n locale\n );\n\n if (!existsSync(localeDir)) continue;\n\n const localeFiles = collectFilesRecursively(localeDir, locales);\n\n for (const filePath of localeFiles) {\n const sourcePath = filePath.replace(versionsDir, 'versions');\n versionedUrls[sourcePath] = rewrites.localeRewriteProcessor?.(\n sourcePath,\n version,\n locale\n ).replace(`/${ rewrites.localePrefix! }`, '') ?? '';\n }\n }\n }\n\n return versionedUrls;\n}\n\n/**\n * Updates the configuration object with versioned routes for documentation.\n *\n * @param config - The configuration object to update with versioned URLs.\n * @param versions - An array of documentation versions.\n * @param docPath - The root path to the documentation folder.\n *\n * @returns void\n *\n * @remarks\n * - Calls {@link generateVersionedUrls} to generate mappings for all versions and locales.\n * - Merges the generated URLs into `config.rewrites`.\n *\n * @example\n * ```ts\n * versionRoutes(config, ['1.0.0', '2.0.0'], '/docs');\n * ```\n *\n * @since 1.0.0\n */\n\nexport function versionRoutes(config: ConfigInterface, versions: Array<string>, docPath: string): void {\n config.rewrites = {\n ...config.rewrites,\n ...generateVersionedUrls(\n config.versioning.rewrites!,\n docPath,\n versions,\n Object.keys(config.locales ?? {})\n )\n };\n}\n"],
6
- "mappings": "+EAYA,OAAS,QAAAA,MAAY,OCmBd,SAASC,EAAuBC,EAA+BC,EAAyBC,EAA6C,CAOxI,GANI,UAAWF,GAAWA,EAAQ,QAC9BA,EAAQ,MAAQA,EAAQ,MAAM,IAAKG,GAC/BJ,EAAuBI,EAAMF,EAAUC,CAAa,CACxD,GAGA,cAAeF,GAAWA,EAAQ,UAAW,CAC7C,IAAMI,EAAgBJ,EAKtBI,EAAc,QAAU,CAAC,EACzBA,EAAc,MAAM,iBAAmB,CACnC,SAAAH,EACA,cAAAC,CACJ,CACJ,CAEA,OAAOF,CACX,CArBgBK,EAAAN,EAAA,0BA8CT,SAASO,EAAcC,EAAoCN,EAAyBC,EAAwB,GAAU,CACpH,MAAM,QAAQK,EAAY,GAAG,IAElCA,EAAY,IAAMA,EAAY,IAAI,IAAKJ,GACnCJ,E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SAASc,EAAcC,EAAyBZ,EAAyBD,EAAuB,CACnGa,EAAO,SAAW,CACd,GAAGA,EAAO,SACV,GAAGf,EACCe,EAAO,WAAW,SAClBb,EACAC,EACA,OAAO,KAAKY,EAAO,SAAW,CAAC,CAAC,CACpC,CACJ,CACJ,CAVgBhB,EAAAe,EAAA,iBP5HhB,OAAS,cAAAE,EAAY,aAAAC,EAAW,eAAAC,EAAa,iBAAAC,MAAqB,KA4C3D,SAASC,GAA+EC,EAA2C,CACtI,IAAMC,EAAWC,EAAK,QAAQ,IAAI,EAAGF,EAAO,IAAI,EAC1CG,EAAWD,EAAKD,EAAUD,EAAO,QAAU,EAAE,EAC7CI,EAAiBF,EAAKC,EAAU,UAAU,EAE3CE,EAAWD,CAAc,IAC1BE,EAAUF,CAAc,EACxBG,EAAcL,EAAKE,EAAgB,UAAU,EAAG,EAAE,GAGtD,IAAMI,EAAqBC,EAAYL,EAAgB,CAAE,cAAe,EAAK,CAAC,EACzE,OAAQM,GAAkBA,EAAM,YAAY,CAAC,EAC7C,IAAKA,GAAkBA,EAAM,IAAI,EAEtC,OAAAV,EAAO,WAA6CW,EAAkBX,EAAO,WAAYY,CAAa,EACtGC,EAAYb,EAAQQ,EAAUP,CAAQ,EACtCa,EAAcd,EAAQQ,EAAUL,CAAQ,EAEjCH,CACX,CAnBgBe,EAAAhB,GAAA",
7
- "names": ["join", "addVersioningToNavItem", "navItem", "versions", "latestVersion", "item", "componentItem", "__name", "versioningNav", "themeConfig", "xterm", "assignMissingDeep", "target", "source", "key", "sourceValue", "targetValue", "__name", "versionSwitcher", "themeConfig", "versions", "latestVersion", "defaults", "assignMissingDeep", "text", "includeLatestVersion", "items", "version", "__name", "resolve", "existsSync", "readFileSync", "replaceLinksRecursive", "sidebarOptions", "version", "sidebar", "item", "__name", "loadSidebar", "locale", "rootPath", "sidebarPath", "resolve", "existsSync", "readFileSync", "multiSidebar", "key", "versioningSidebar", "config", "versions", "locales", "versionSidebars", "themeConfig", "config", "versions", "rootPath", "themeConfigArray", "locale", "versionSwitcher", "versioningNav", "xterm", "versioningSidebar", "__name", "defaultConfig", "__name", "inputFilePath", "_version", "locale", "version", "url", "posix", "existsSync", "readdirSync", "collectFilesRecursively", "dirPath", "locales", "files", "entry", "readdirSync", "fullPath", "posix", "__name", "generateVersionedUrls", "rewrites", "docPath", "versions", "versionedUrls", "versionsDir", "version", "versionPath", "filePath", "sourcePath", "locale", "localeDir", "existsSync", "localeFiles", "versionRoutes", "config", "existsSync", "mkdirSync", "readdirSync", "writeFileSync", "defineVersionedConfig", "config", "rootPath", "join", "docsPath", "versionsFolder", "existsSync", "mkdirSync", "writeFileSync", "versions", "readdirSync", "entry", "assignMissingDeep", "defaultConfig", "themeConfig", "versionRoutes", "__name"]
3
+ "sources": ["../src/models/state.model.ts", "../src/modules/symlinks/services/inject.service.ts", "../src/components/rewrites.component.ts", "../src/constants/configuration.constant.ts", "../src/components/object.component.ts", "../src/components/nav.component.ts", "../src/components/switcher.component.ts", "../src/components/locale.component.ts", "../src/components/sidebar.component.ts", "../src/index.ts"],
4
+ "sourceRoot": "https://github.com/viteplus/versions/tree/v2.0.1/",
5
+ "sourcesContent": ["/**\n * Import will remove at compile time\n */\n\nimport type { Dirent } from 'fs';\nimport type { ConfigurationInterface } from '@interfaces/configuration.interface';\nimport type { VersionsConfigInterface, VitepressConfigInterface } from '@interfaces/configuration.interface';\n\n/**\n * Imports\n */\n\nimport { join, posix } from 'path';\nimport { xterm } from '@remotex-labs/xansi/xterm.component';\nimport { Injectable } from '@symlinks/services/inject.service';\nimport { existsSync, mkdirSync, readdirSync, writeFileSync } from 'fs';\nimport { defaultConfiguration } from '@constants/configuration.constant';\nimport { getAllMarkdownFilesRelative } from '@components/object.component';\n\n/**\n * Manages the state of a versioned VitePress documentation project.\n *\n * @remarks\n * The `StateModel` class is responsible for:\n * - Managing source and archive directories for versioned documentation.\n * - Initializing the VitePress configuration (`VitepressConfigInterface`) from\n * a provided {@link ConfigurationInterface}.\n * - Maintaining a list of documentation versions and a map of Markdown files per version.\n * - Ensuring the necessary directories exist and are initialized.\n *\n * This service is designed as a singleton, making it safe to inject across\n * your application using `@Injectable({ scope: 'singleton' })`.\n *\n * @example\n * ```ts\n * import { StateModel } from \"@models/state.model\";\n *\n * const state = new StateModel(config).init();\n * console.log(state.versionsList);\n * console.log(state.fileMap);\n * ```\n *\n * @since 2.0.0\n */\n\n@Injectable({\n scope: 'singleton'\n})\nexport class StateModel {\n /**\n * The root path of the documentation project,\n * based on the current working directory and optional srcDir.\n *\n * @since 2.0.0\n */\n\n readonly root: string;\n\n /**\n * The name of the sources directory from which current content.\n *\n * @default `src`\n * @since 2.0.0\n */\n\n readonly sources: string;\n\n /**\n * The name of the archive directory where old versions are stored.\n *\n * @default `archive`\n * @since 2.0.0\n */\n\n readonly archive: string;\n\n /**\n * Full path to the `sources` directory.\n *\n * @since 2.0.0\n */\n\n readonly sourcesPath: string;\n\n /**\n * Full path to the `archive` directory.\n *\n * @since 2.0.0\n */\n\n readonly archivePath: string;\n\n /**\n * The `versions` configuration object for the plugin.\n *\n * @remarks\n * This property holds the currently active versions configuration\n * as defined in {@link VersionsConfigInterface}. It includes settings\n * like the current version, sources, archive, hooks, and version switcher.\n *\n * @see VersionsConfigInterface\n * @since 2.0.0\n */\n\n readonly versionsConfig: VersionsConfigInterface;\n\n /**\n * The VitePress configuration object crafted from the user-provided configuration,\n * with versioning support added.\n *\n * @remarks\n * This object is based on the user configuration and extended to include\n * locales, rewrites, and versioning-aware settings. It is typed as\n * {@link VitepressConfigInterface}.\n *\n * @see VitepressConfigInterface\n * @since 2.0.0\n */\n\n readonly vitepressConfig: VitepressConfigInterface;\n\n /**\n * List of all available documentation versions.\n *\n * @remarks\n * This array is populated during initialization (`init()`) by reading the archive\n * and sources directories. Each element is a version string (e.g., `\"1.0\"`, `\"2.0\"`).\n *\n * @since 2.0.0\n */\n\n readonly versionsList: Array<string> = [];\n\n /**\n * Maps locale keys to their effective base paths.\n *\n * @remarks\n * - Keys are the locale identifiers as defined in the user configuration\n * (e.g., `\"de\"`, `\"root\"`).\n * - Values are the corresponding effective base paths or link prefixes\n * used inside the generated VitePress config.\n * - The `\"root\"` locale always maps to the default language of the site.\n *\n * This mapping is used internally to resolve and normalize locale-based\n * routing for both source files and versioned archives.\n *\n * @example\n * ```ts\n * localesMap = {\n * en: \"root\",\n * de: \"de\"\n * };\n * ```\n *\n * @since 2.0.0\n */\n\n readonly localesMap: Record<string, string> = {};\n\n /**\n * A map of version names to arrays of Markdown file paths relative to the sources directory.\n *\n * @remarks\n * - The key is the version name (or `''` for the root/source version).\n * - The value is an array of file paths (strings) for that version.\n *\n * This structure is built during initialization to facilitate generating versioned\n * documentation and navigation.\n *\n * @since 2.0.0\n */\n\n readonly fileMap: Record<string, Array<string>> = {};\n\n /**\n * Creates an instance of `StateModel`.\n *\n * @param configuration - Optional configuration object; defaults to {@link defaultConfiguration}.\n *\n * @throws Will throw an error if the sources directory does not exist.\n *\n * @remarks\n * Initializes the state of the documentation project by:\n * - Extracting `sources` and `archive` from the provided configuration.\n * - Constructing full paths for `root`, `sourcesPath`, and `archivePath`.\n * - Validating that the sources directory exists.\n * - Ensuring the archive directory exists and creating a `.gitkeep` file if necessary.\n * - Creating a VitePress configuration object with versioning support.\n *\n * @since 2.0.0\n */\n\n constructor(readonly configuration: ConfigurationInterface = defaultConfiguration) {\n const { sources, archive } = configuration.versionsConfig;\n\n this.sources = sources;\n this.archive = archive;\n this.versionsConfig = configuration.versionsConfig;\n\n this.root = join(process.cwd(), process.argv[3] ?? '', configuration.srcDir ?? '');\n this.sourcesPath = join(this.root, this.sources);\n this.archivePath = join(this.root, this.archive);\n\n if (!existsSync(this.sourcesPath)) {\n console.error(xterm.red('[ viteplus ]'), `Source directory ${ this.sourcesPath } does not exist\\n`);\n throw new Error(`Source directory ${ this.sourcesPath } does not exist`);\n }\n\n this.makeArchiveDirectory(this.archivePath);\n this.vitepressConfig = this.createVitepressConfig();\n }\n\n /**\n * Initializes the state by reading archive subfolders and building file maps.\n *\n * @returns The instance itself (`this`) to allow method chaining.\n *\n * @remarks\n * This method performs the following steps:\n * - Reads all subdirectories in the archive directory.\n * - Populates `fileMap` with all Markdown files relative to the sources directory.\n * - The root source files are stored under the `''` key.\n * - Archive subfolders are stored under their folder names.\n * - Initializes `vitepressConfig.locales` for each folder with an empty `themeConfig`.\n * - Populates `versionsList` with all version keys derived from `fileMap`.\n *\n * @since 2.0.0\n */\n\n init(): this {\n const subFolders = readdirSync(this.archivePath, { withFileTypes: true })\n .filter((entry: Dirent) => entry.isDirectory());\n\n this.fileMap[''] = getAllMarkdownFilesRelative(this.sourcesPath);\n this.vitepressConfig.locales['root'] = {\n themeConfig: {}\n };\n\n for (const folder of subFolders) {\n const path = join(folder.parentPath, folder.name);\n this.fileMap[folder.name] = getAllMarkdownFilesRelative(path);\n }\n\n this.initializeLocalesMap();\n\n return this;\n }\n\n /**\n * Initializes the locale entries in the VitePress configuration and builds a mapping\n * of locales to their links for all versions.\n *\n * @remarks\n * - Adds a `root` locale entry.\n * - Copies all user-defined locales into the VitePress config.\n * - Populates `localesMap` with locale keys and their corresponding links (or folder names).\n * - Ensures that for each documentation version, a locale entry exists in the VitePress config.\n * - Handles both root and non-root locales, creating versioned paths automatically.\n *\n * @since 2.0.0\n */\n\n private initializeLocalesMap(): void {\n const locales = this.vitepressConfig.locales;\n const userLocales = this.configuration.locales;\n this.versionsList.push(...Object.keys(this.fileMap).filter(Boolean));\n\n locales['root'] = {};\n if (Object.keys(userLocales).length > 0) {\n const keys = Object.keys(userLocales);\n const rootLocaleKey = 'root' in userLocales ? 'root' : keys[0];\n\n for (const key of keys) {\n const index = userLocales[key].lang ?? key;\n for (const version of this.versionsList) {\n if(key === rootLocaleKey) continue;\n const versionPath = posix.join(index, version);\n locales[versionPath] = {};\n }\n\n if (key === rootLocaleKey) {\n this.localesMap[userLocales[key].link ?? index] = 'root';\n } else {\n locales[key] = {};\n this.localesMap[userLocales[key].link ?? index] = key;\n }\n }\n }\n\n for (const version of this.versionsList) {\n locales[version] = {};\n }\n }\n\n /**\n * Ensures that the archive directory exists.\n *\n * @param path - The path to the archive directory.\n *\n * @remarks\n * - If the directory does not exist, it is created.\n * - A `.gitkeep` file is also added to ensure the directory is tracked by Git.\n *\n * @since 2.0.0\n */\n\n private makeArchiveDirectory(path: string): void {\n if (!path) return;\n\n if (!existsSync(path)) {\n mkdirSync(path);\n writeFileSync(join(path, '.gitkeep'), '');\n }\n }\n\n /**\n * Creates a VitePress configuration object from the user-provided configuration.\n *\n * @returns A `VitepressConfigInterface` object with versioning support added.\n *\n * @remarks\n * - Copies all configuration properties except for `locales`, `rewrites`, `themeConfig`, and `versionsConfig`.\n * - Initializes excluded properties (except `versionsConfig`) with empty objects.\n * - Returns a configuration object typed as {@link VitepressConfigInterface}, ready for VitePress usage.\n *\n * @see VitepressConfigInterface\n * @since 2.0.0\n */\n\n private createVitepressConfig(): VitepressConfigInterface {\n const result: Record<string, unknown> = {};\n const exclude: Array<keyof ConfigurationInterface> = [\n 'locales',\n 'rewrites',\n 'themeConfig',\n 'versionsConfig'\n ];\n\n for (const key of Object.keys(this.configuration) as Array<keyof ConfigurationInterface>) {\n if (!exclude.includes(key)) {\n result[key] = this.configuration[key];\n } else if (key === 'themeConfig') {\n const themeConfig = this.configuration.themeConfig ?? {};\n result.themeConfig = Object.fromEntries(\n Object.entries(themeConfig).filter(\n ([ prop ]) => prop !== 'nav' && prop !== 'sidebar'\n )\n );\n } else if (key !== 'versionsConfig') {\n result[key] = {};\n }\n }\n\n return <VitepressConfigInterface><unknown>result;\n }\n}\n", "/**\n * Import will remove at compile time\n */\n\nimport type { ProviderUseClassInterface } from '@symlinks/interfaces/symlinks.interface';\nimport type { ConstructorLikeType, ConstructorType } from '@interfaces/function.interface';\nimport type { InjectableOptionsInterface, ProvidersType } from '@symlinks/interfaces/symlinks.interface';\nimport type { ProviderUseFactoryInterface, ProviderUseValueInterface } from '@symlinks/interfaces/symlinks.interface';\n\n/**\n * A collection of singleton instances for injectable classes.\n *\n * @remarks\n * This map stores instances of classes marked as `singleton` in `@Injectable` metadata.\n * It ensures that only one instance exists for the lifetime of the application.\n *\n * @see ConstructorType\n * @since 2.0.0\n */\n\nexport const SINGLETONS = new Map<ConstructorType, unknown>();\n\n/**\n * Stores metadata for all classes marked with the `@Injectable` decorator.\n *\n * @remarks\n * The metadata includes scope, factory function, and provider dependencies.\n *\n * @see Injectable\n * @since 2.0.0\n */\n\nexport const INJECTABLES = new Map<ConstructorType, InjectableOptionsInterface>();\n\n/**\n * Type guard to check if a provider uses a class.\n *\n * @param provider - The provider to check.\n * @returns True if the provider is a {@link ProviderUseClassInterface}.\n *\n * @see ProviderUseClassInterface\n * @since 2.0.0\n */\n\nexport function isProviderUseClass(provider: unknown): provider is ProviderUseClassInterface {\n return typeof provider === 'object' && provider !== null && 'useClass' in provider;\n}\n\n/**\n * Type guard to check if a provider uses a factory function.\n *\n * @param provider - The provider to check.\n * @returns True if the provider is a {@link ProviderUseFactoryInterface}.\n *\n * @see ProviderUseFactoryInterface\n * @since 2.0.0\n */\n\nexport function isProviderUseFactory(provider: unknown): provider is ProviderUseFactoryInterface {\n return typeof provider === 'object' && provider !== null && 'useFactory' in provider;\n}\n\n/**\n * Type guard to check if a provider uses a value.\n *\n * @param provider - The provider to check.\n * @returns True if the provider is a {@link ProviderUseValueInterface}.\n *\n * @see ProviderUseValueInterface\n * @since 2.0.0\n */\n\nexport function isProviderUseValue(provider: unknown): provider is ProviderUseValueInterface {\n return typeof provider === 'object' && provider !== null && 'useValue' in provider;\n}\n\n/**\n * Marks a class as injectable, optionally providing metadata.\n *\n * @param options - Optional configuration for the injectable class.\n *\n * @remarks\n * The `@Injectable` decorator allows classes to be automatically instantiated\n * and injected with dependencies using the `inject` function.\n *\n * @example\n * ```ts\n * @Injectable({ scope: 'singleton' })\n * class MyService {}\n *\n * const instance = inject(MyService);\n * ```\n *\n * @see InjectableOptionsInterface\n * @since 2.0.0\n */\n\nexport function Injectable<T extends ConstructorType = ConstructorType>(options?: InjectableOptionsInterface<T>) {\n return function (target: T): void {\n INJECTABLES.set(target, <InjectableOptionsInterface>options || {});\n };\n}\n\n/**\n * Converts an array of providers into constructor arguments for injection.\n *\n * @param providers - An optional array of providers to resolve.\n * @param args - Optional initial arguments to prepend before resolving providers.\n * @returns An array of resolved arguments including the results from providers.\n *\n * @remarks\n * This function iterates over the provided `ProvidersType` array and converts each provider\n * into its resolved value. It supports class providers, factory providers, value providers,\n * and direct constructor functions. The returned array can be used to construct instances\n * with dependencies injected in the correct order.\n *\n * @example\n * ```ts\n * const args = providersIntoArgs([{ useValue: 42 }, { useFactory: () => 'hello' }]);\n * // args = [42, 'hello']\n * ```\n *\n * @see isProviderUseClass\n * @see isProviderUseValue\n * @see isProviderUseFactory\n *\n * @since 2.0.0\n */\n\nexport function providersIntoArgs(providers?: ProvidersType, args: Array<unknown> = []): Array<unknown> {\n if (!providers) return args;\n\n const scopeAgs: Array<unknown> = args;\n for (const provider of providers.slice(scopeAgs.length)) {\n if (isProviderUseClass(provider)) {\n scopeAgs.push(inject(provider.useClass, ...providersIntoArgs(provider.providers)));\n } else if (isProviderUseFactory(provider)) {\n scopeAgs.push(provider.useFactory(...providersIntoArgs(provider.providers)));\n } else if (isProviderUseValue(provider)) {\n scopeAgs.push(provider.useValue);\n } else if (typeof provider === 'function') {\n scopeAgs.push(inject(provider));\n } else {\n throw new Error(`Unknown provider type: ${ typeof provider }`);\n }\n }\n\n return scopeAgs;\n}\n\n/**\n * Resolves and instantiates a class with its dependencies.\n *\n * @param token - The constructor function or class to instantiate.\n * @param args - Optional arguments to pass to the constructor, which can override\n * or supplement provider-resolved values.\n * @returns An instance of the class with all dependencies injected.\n *\n * @remarks\n * The `inject` function looks up metadata for the class marked with `@Injectable`.\n * It resolves all providers recursively using `providersIntoArgs`. If the class is\n * marked as a `singleton`, the same instance will be returned on further calls.\n *\n * @example\n * ```ts\n * @Injectable({ scope: 'singleton' })\n * class MyService {}\n *\n * const instance = inject(MyService);\n * ```\n *\n * @see Injectable\n * @see providersIntoArgs\n *\n * @since 2.0.0\n */\n\nexport function inject<T, Args extends Array<unknown>>(token: ConstructorLikeType<T, Args>, ...args: Partial<Args>): T {\n if (SINGLETONS.has(token)) return <T>SINGLETONS.get(token);\n\n const metadata = INJECTABLES.get(token)!;\n if (!metadata) throw new Error(`Cannot inject ${ token.name } \u2013 not marked @Injectable`);\n\n const scopeAgs = providersIntoArgs(metadata.providers, args);\n const instance: T = metadata.factory\n ? <T>metadata.factory(...scopeAgs)\n : new token(...scopeAgs as Args);\n\n if (metadata?.scope === 'singleton') {\n SINGLETONS.set(token, instance);\n }\n\n return instance;\n}\n\n/**\n * Forces the instantiation of a class, bypassing any existing singleton instance.\n *\n * @param token - The constructor function or class to instantiate.\n * @param args - Optional arguments to pass to the constructor, which can override\n * or supplement provider-resolved values.\n * @returns A new instance of the class, even if a singleton instance already exists.\n *\n * @remarks\n * Unlike the `inject` function, `forceInject` will delete any existing singleton\n * instance for the given class before creating a new one. This is useful when you\n * need a fresh instance regardless of the singleton scope.\n *\n * @example\n * ```ts\n * @Injectable({ scope: 'singleton' })\n * class MyService {}\n *\n * const freshInstance = forceInject(MyService);\n * ```\n *\n * @see inject\n * @since 2.0.0\n */\n\nexport function forceInject<T, Args extends Array<unknown>>(token: ConstructorLikeType<T, Args>, ...args: Partial<Args>): T {\n if (SINGLETONS.has(token)) SINGLETONS.delete(token);\n\n return inject<T, Args>(token, ...args);\n}\n", "/**\n * imports\n */\n\nimport { join } from 'path/posix';\nimport { StateModel } from '@models/state.model';\nimport { inject } from '@symlinks/services/inject.service';\n\n/**\n * Rewrites a documentation source path using version and locale.\n *\n * @remarks\n * This implementation joins the `version`, `locale`, and original `source`\n * into a normalized POSIX-style path. It is commonly used to generate\n * consistent URLs or filesystem paths for versioned and localized docs.\n *\n * @param source - The original file path or content identifier.\n * @param version - The version string of the documentation (e.g., `\"1.2.0\"`).\n * @param locale - The locale code (e.g., `\"en\"`, `\"de\"`).\n *\n * @returns The rewritten path string in the format `version/locale/source`.\n *\n * @example\n * ```ts\n * rewritesHook(\"guide/intro.md\", \"v2.0.0\", \"en\");\n * // \u2192 \"en/v2.0.0/guide/intro.md\"\n * ```\n *\n * @since 2.0.0\n */\n\nexport function rewritesHook(source: string, version: string, locale: string): string {\n return join(locale, version, source);\n}\n\n/**\n * Parses all documentation routes and generates rewritten paths for versioned and localized files.\n *\n * @remarks\n * - Iterates through the `fileMap` of the `StateModel` to process all Markdown files.\n * - Determines the correct locale for each file using `localesMap`.\n * - Uses the `rewritesHook` from `versionsConfig.hooks` to generate the versioned and localized path.\n * - Populates the `vitepressConfig.rewrites` object with the mapping of original paths to rewritten paths.\n *\n * @example\n * ```ts\n * parseRoutesComponent();\n * console.log(state.vitepressConfig.rewrites);\n * // \u2192 {\n * \"src/en/index.md\": \"en/index.md\",\n * \"src/de/index.md\": \"index.md\",\n * \"archive/x0.0.1/en/index.md\": \"x0.0.1/en/index.md\"\n * ...\n * }\n * ```\n *\n * @since 2.0.0\n */\n\nexport function parseRoutesComponent(): void {\n const result: Record<string, string> = {};\n const state = inject(StateModel);\n const localesPrefix = Object.keys(state.localesMap);\n\n for (const [ folder, fileList ] of Object.entries(state.fileMap)) {\n const prefix = folder === '' ? state.sources : state.archive;\n\n for (const file of fileList) {\n const localeKey = localesPrefix[localesPrefix.findIndex(item => file.startsWith(item))];\n const locale = state.localesMap[localeKey] === 'root' ? '' : localeKey ?? '';\n\n result[join(prefix, folder, file)] = state.versionsConfig.hooks.rewritesHook(\n file.replace(localeKey + '/', ''), folder, locale\n );\n }\n }\n\n state.vitepressConfig.rewrites = result;\n}\n", "/**\n * Import will remove at compile time\n */\n\nimport type { ConfigurationInterface } from '@interfaces/configuration.interface';\n\n/**\n * Imports\n */\n\nimport { rewritesHook } from '@components/rewrites.component';\n\n/**\n * Default configuration object for the `versions` system.\n *\n * @remarks\n * Provides a baseline implementation of {@link ConfigurationInterface}.\n * This includes:\n * - Empty `locales` and `rewrites` mappings.\n * - A `versionsConfig` with:\n * - `current` set to `\"latest\"`.\n * - `sources` pointing to `\"src\"`.\n * - `archive` pointing to `\"archive\"`.\n * - `hooks.rewritesHook` bound to the default {@link rewritesHook}.\n * - A `versionSwitcher` enabled with label `\"Switch Version\"` and\n * `includeCurrentVersion` set to `true`.\n *\n * This default setup can be extended or overridden as needed when\n * customizing your documentation site.\n *\n * @example\n * ```ts\n * import { defaultConfiguration } from \"@config/default.configuration\";\n *\n * export default {\n * ...defaultConfiguration,\n * locales: {\n * en: { link: \"/en/\", label: \"English\" }\n * }\n * };\n * ```\n *\n * @since 2.0.0\n */\n\nexport const defaultConfiguration: ConfigurationInterface = {\n locales: {},\n rewrites: {},\n versionsConfig: {\n current: 'latest',\n sources: 'src',\n archive: 'archive',\n hooks: {\n rewritesHook: rewritesHook\n },\n versionSwitcher: {\n text: 'Switch Version',\n includeCurrentVersion: true\n }\n }\n};\n", "/**\n * Imports\n */\n\nimport { readdirSync } from 'fs';\nimport { join, relative } from 'path/posix';\n\n/**\n * Deeply merges two object types into a single object.\n *\n * @typeParam T - The type of the first object.\n * @typeParam U - The type of the second object.\n *\n * @param obj1 - The base object whose properties will be merged.\n * @param obj2 - The object whose properties will overwrite or merge into `obj1`.\n * @returns A new object containing the deeply merged properties of both `obj1` and `obj2`.\n *\n * @remarks\n * - This function performs a deep merge, recursively merging nested objects.\n * - If a property exists in both `obj1` and `obj2`:\n * - If both values are plain objects, they are merged recursively.\n * - Otherwise, the value from `obj2` overwrites the value from `obj1`.\n * - Arrays are **not** merged; if a property is an array in `obj2`, it will replace\n * the corresponding property in `obj1`.\n *\n * @example\n * ```ts\n * const obj1 = { a: 1, b: { c: 2, d: 3 } };\n * const obj2 = { b: { c: 42 }, e: 99 };\n *\n * const merged = deepMerge(obj1, obj2);\n * // Result: { a: 1, b: { c: 42, d: 3 }, e: 99 }\n * ```\n *\n * @since 2.0.0\n */\n\nexport function deepMerge<T extends object, U extends object>(obj1: T, obj2: U): T & U {\n const result = <Record<string, unknown>> { ...obj1 };\n\n for (const key in obj2) {\n if (Object.prototype.hasOwnProperty.call(obj2, key)) {\n const val2 = (obj2 as T & U)[key];\n const val1 = (obj1 as T & U)[key];\n\n if (\n val1 && typeof val1 === 'object' &&\n val2 && typeof val2 === 'object' &&\n !Array.isArray(val2) && !Array.isArray(val2)\n ) {\n result[key] = deepMerge(val1 as object, val2 as object);\n } else {\n result[key] = val2;\n }\n }\n }\n\n return result as T & U;\n}\n\n/**\n * Recursively collects all Markdown (`.md`) files within a given directory,\n * returning their paths relative to a specified root directory.\n *\n * @param rootDir - The root directory used as the base for relative paths.\n * @param currentDir - The current directory to scan. Defaults to `rootDir`.\n * @returns An array of relative file paths to Markdown files.\n *\n * @remarks\n * - This function traverses directories recursively.\n * - Only files with a `.md` extension are included in the results.\n * - Returned paths are **relative to `rootDir`**, regardless of how deep the files are nested.\n * - Uses Node.js `fs.readdirSync` with `withFileTypes: true` for efficient directory traversal.\n *\n * @example\n * ```ts\n * const markdownFiles = getAllMarkdownFilesRelative(\"/project/docs\");\n *\n * console.log(markdownFiles);\n * // Example output:\n * // [\n * // \"README.md\",\n * // \"guide/intro.md\",\n * // \"tutorial/setup.md\"\n * // ]\n * ```\n *\n * @since 2.0.0\n */\n\nexport function getAllMarkdownFilesRelative(rootDir: string, currentDir: string = rootDir): Array<string> {\n let results: Array<string> = [];\n const entries = readdirSync(currentDir, { withFileTypes: true });\n\n for (const entry of entries) {\n const fullPath = join(currentDir, entry.name);\n\n if (entry.isDirectory()) {\n results = results.concat(getAllMarkdownFilesRelative(rootDir, fullPath));\n } else if (entry.isFile() && entry.name.endsWith('.md')) {\n const relativePath = relative(rootDir, fullPath);\n results.push(relativePath);\n }\n }\n\n return results;\n}\n", "/**\n * Import will remove at compile time\n */\n\nimport type { NavItemType, NavItemWithChildrenType } from '@interfaces/nav.interface';\nimport type { NavItemWithLinkType, NavObjectType, NavType } from '@interfaces/nav.interface';\n\n/**\n * Imports\n */\n\nimport { join } from 'path/posix';\nimport { StateModel } from '@models/state.model';\nimport { inject } from '@symlinks/services/inject.service';\nimport { versionSwitcher } from '@components/switcher.component';\n\n/**\n * Type guard to check if a navigation item has children.\n *\n * @param item - The navigation item to test.\n * @returns `true` if the item is a {@link NavItemWithChildrenType}, `false` otherwise.\n *\n * @remarks\n * - This function checks for the presence of an `item` property that is an array.\n * - Use this type guard to safely access child navigation items when iterating\n * or transforming navigation trees.\n *\n * @example\n * ```ts\n * const item: NavItemType = { text: \"Docs\", items: [{ text: \"Guide\", link: \"/guide/\" }] };\n * if (isNavItemWithChildren(item)) {\n * console.log(item.items); // Safe to access\n * }\n * ```\n *\n * @since 2.0.0\n */\n\nexport function isNavItemWithChildren(item: NavItemType): item is NavItemWithChildrenType {\n return 'items' in item && Array.isArray(item.items);\n}\n\n/**\n * Type guard to check if a navigation item has a link.\n *\n * @param item - The navigation item to test.\n * @returns `true` if the item is a {@link NavItemWithLinkType}, `false` otherwise.\n *\n * @remarks\n * - This function checks for the presence of a `link` property.\n * - Use this type guard to safely access the `link` property when iterating\n * or transforming navigation trees.\n *\n * @example\n * ```ts\n * const item: NavItemType = { text: \"Home\", link: \"/\" };\n * if (isNavItemWithLink(item)) {\n * console.log(item.link); // Safe to access\n * }\n * ```\n *\n * @since 2.0.0\n */\n\nexport function isNavItemWithLink(item: NavItemType): item is NavItemWithLinkType {\n return 'link' in item && !!item.link;\n}\n\n/**\n * Recursively prepends a version prefix to navigation item links.\n *\n * @param version - The version string to prefix (e.g., `\"v2.0.0\"`).\n * @param item - The navigation item to process, which can be a link, a group with children, or a component.\n * @returns A new navigation item with updated `link` values where applicable.\n *\n * @remarks\n * - For {@link NavItemWithLinkType}, prepends the given `version` to the `link`\n * unless `skipVersioning` is `true`.\n * - For {@link NavItemWithChildrenType}, recursively traverses all children and applies\n * the same transformation.\n * - Component-based navigation items ({@link NavItemComponentType}) are returned as-is.\n * - Preserves other properties of the navigation items.\n *\n * @example\n * ```ts\n * const navItem: NavItemWithLinkType = { text: \"Guide\", link: \"/guide/\" };\n * const result = replaceLinksRecursive(\"v2.0.0\", navItem);\n * // \u2192 { text: \"Guide\", link: \"/v2.0.0/guide/\" }\n *\n * const navGroup: NavItemWithChildrenType = {\n * text: \"Docs\",\n * items: [{ text: \"Intro\", link: \"/intro/\" }]\n * };\n * const groupResult = replaceLinksRecursive(\"v2.0.0\", navGroup);\n * // \u2192 { text: \"Docs\", items: [{ text: \"Intro\", link: \"/v2.0.0/intro/\" }] }\n * ```\n *\n * @since 2.0.0\n */\n\nexport function replaceLinksRecursive(version: string, item: NavItemType): NavItemType {\n if (isNavItemWithChildren(item) && !item.skipVersioning) {\n return {\n ...item,\n items: item.items.map(child => replaceLinksRecursive(version, child))\n };\n }\n\n if (isNavItemWithLink(item) && !item.skipVersioning) {\n return {\n ...item,\n link: join('/', version, item.link)\n };\n }\n\n return item;\n}\n\n/**\n * Applies version prefixes to an array of navigation items.\n *\n * @param items - An array of navigation items to process.\n * @param version - The version string to prepend to links (e.g., `\"v2.0.0\"`).\n * - If `\"root\"` is provided, no version prefix is added.\n * @returns A new array of navigation items with versioned links applied.\n *\n * @remarks\n * - Uses {@link replaceLinksRecursive} to traverse each navigation item.\n * - Only items that are link-based or have children are modified; component items remain unchanged.\n * - Preserves other properties of the navigation items.\n *\n * @example\n * ```ts\n * const navItems: NavItemType[] = [\n * { text: \"Guide\", link: \"/guide/\" },\n * { text: \"Docs\", items: [{ text: \"Intro\", link: \"/intro/\" }] }\n * ];\n * const versionedNav = populateNav(navItems, \"v2.0.0\");\n * // \u2192 [\n * // { text: \"Guide\", link: \"/v2.0.0/guide/\" },\n * // { text: \"Docs\", items: [{ text: \"Intro\", link: \"/v2.0.0/intro/\" }] }\n * // ]\n * ```\n *\n * @since 2.0.0\n */\n\nexport function populateNav(items: Array<NavItemType>, version: string): Array<NavItemType> {\n const state = inject(StateModel);\n if (version === 'root') version = '';\n\n return items.map(item => {\n if ('component' in item && item.component) {\n return {\n ...item,\n props: {\n ...item.props,\n versioningPlugin: {\n versions: state.versionsList,\n currentVersion: state.versionsConfig.current\n }\n }\n };\n }\n\n return replaceLinksRecursive(version, item);\n });\n}\n\n/**\n * Normalizes a navigation structure into a flat, prefixed record.\n *\n * @param results - The target {@link NavObjectType} to populate with normalized items.\n * @param nav - The navigation structure to normalize. Can be:\n * - An array of navigation items (`NavItemType[]`), or\n * - A record mapping strings to arrays of navigation items (`NavObjectType`).\n * @param prefix - Optional prefix for keys when processing nested navigation objects.\n * Defaults to an empty string.\n * @param root - Optional root-level navigation items to include in all normalized entries.\n *\n * @remarks\n * - If `nav` is an array, it merges it with the root items (if any) and appends to `results.root`.\n * - If `nav` is a record:\n * - Each key is prefixed with `prefix` unless it is `'root'`.\n * - Items from `root` or `root.root` are merged into each key.\n * - All items are accumulated in the `results` object, preserving the hierarchy as flat keys.\n *\n * @example\n * ```ts\n * const nav: NavObjectType = {\n * root: [{ text: \"Home\", link: \"/\" }],\n * guide: [{ text: \"Intro\", link: \"/intro/\" }]\n * };\n * const results: NavObjectType = { root: [] };\n * normalizeNav(results, nav, \"v2.0.0\");\n * // results \u2192 {\n * // root: [{ text: \"Home\", link: \"/\" }],\n * // \"v2.0.0/guide\": [{ text: \"Intro\", link: \"/intro/\" }]\n * // }\n * ```\n *\n * @since 2.0.0\n */\n\nexport function normalizeNav(results: NavObjectType, nav: NavType, prefix: string = '', root: NavObjectType = {}): void {\n if (Array.isArray(nav)) {\n const index = prefix ? prefix : 'root';\n\n results[index] ??= [];\n results[index].push(...nav);\n if (root[index]) results[index].push(...root[index]);\n else if (root.root) results[index].push(...root.root);\n\n return;\n }\n\n for (const [ key, items ] of Object.entries(nav)) {\n const subRoot = key === 'root' && prefix === '' ? 'root' : prefix;\n const index = key === 'root' ? subRoot : join(prefix, key);\n\n results[index] ??= [];\n results[index].push(...items);\n if (root[key]) results[index].push(...root[key]);\n else if (root.root) results[index].push(...root.root);\n }\n}\n\n/**\n * Normalizes all navigation structures across the global and locale-specific configurations.\n *\n * @param state - The current {@link StateModel} providing configuration data:\n * - `configuration.themeConfig.nav` \u2014 global navigation configuration.\n * - `configuration.locales` \u2014 locale-specific configurations with optional `nav`.\n *\n * @returns A flat record of navigation items keyed by locale or `'root'`, suitable for further processing.\n *\n * @remarks\n * - First, global navigation items are normalized into `globalResults`.\n * - If no locales are defined, `globalResults` is returned directly.\n * - Otherwise, iterates through all locale keys:\n * - Normalizes each locale\u2019s `nav` configuration.\n * - Merges in global navigation items as fallback where necessary.\n * - Ensures that all navigation entries are flattened and ready for versioning or rendering.\n *\n * @example\n * ```ts\n * const state = inject(StateModel);\n * const normalizedNavs = normalizeNavs(state);\n * // normalizedNavs \u2192 {\n * // root: [...global items],\n * // en: [...English locale items including global fallback],\n * // de: [...German locale items including global fallback]\n * // }\n * ```\n *\n * @since 2.0.0\n */\n\nexport function normalizeNavs(state: StateModel): Record<string, Array<NavItemType>> {\n const locales = state.configuration.locales;\n const localesKeys = Object.keys(locales);\n const globalResults: Record<string, Array<NavItemType>> = { root: [] };\n\n if (state.configuration.themeConfig?.nav) {\n normalizeNav(globalResults, state.configuration.themeConfig.nav as NavType);\n }\n\n const switcher = versionSwitcher(state.versionsConfig, state.versionsList, state.versionsConfig.current);\n if(switcher) globalResults.root.push(switcher);\n\n if (!localesKeys.length) return globalResults;\n const results: Record<string, Array<NavItemType>> = { root: [] };\n\n for (const locale of localesKeys) {\n const prefix = locale === 'root' || state.localesMap[locale] === 'root' ? 'root' : locale;\n normalizeNav(results, (locales[locale].themeConfig?.nav ?? []) as NavType, prefix, globalResults);\n }\n\n return results;\n}\n\n/**\n * Parses and populates the navigation structure for all locales.\n *\n * @remarks\n * - Retrieves normalized navigation items using {@link normalizeNavs}.\n * - Iterates through all locales defined in `vitepressConfig.locales`.\n * - For each locale:\n * - Falls back to global navigation (`navs.root`) if locale-specific navigation is not defined.\n * - Ensures the locale\u2019s `themeConfig` exists.\n * - Populates the locale\u2019s `themeConfig.nav` using {@link populateNav}, applying versioning where applicable.\n *\n * This function ensures that all locales have a fully initialized and version-aware navigation structure.\n *\n * @example\n * ```ts\n * parseNavs();\n * // state.vitepressConfig.locales \u2192 each locale has `themeConfig.nav` populated\n * ```\n *\n * @since 2.0.0\n */\n\nexport function parseNavs(): void {\n const state = inject(StateModel);\n const { vitepressConfig: { locales } } = state;\n const navs = normalizeNavs(state);\n\n for (const [ key, locale ] of Object.entries(locales)) {\n const nav = navs[key] ?? navs.root;\n\n locale.themeConfig ??= {};\n locale.themeConfig.nav = populateNav(nav, key);\n }\n}\n", "/**\n * Imports\n */\n\nimport type { NavItemWithChildrenType } from '@interfaces/nav.interface';\nimport type { VersionsConfigInterface } from '@interfaces/configuration.interface';\n\n/**\n * Builds a version switcher navigation item for the documentation site.\n *\n * @param themeConfig - The {@link VersionsConfigInterface} configuration object.\n * @param versions - An array of available version strings.\n * @param current - The current version label, defaults to `\"Latest\"`.\n *\n * @returns A {@link NavItemWithChildrenType} representing the version switcher,\n * or `undefined` if the switcher is disabled in the configuration.\n *\n * @remarks\n * - If `themeConfig.versionSwitcher === false`, no switcher is created.\n * - The returned navigation item contains child links for each version in `versions`.\n * - If `includeCurrentVersion` is enabled, adds a link to the root (`\"/\"`)\n * for the currently active version, displayed as `\"Latest\"` or\n * `\"vX.Y.Z (latest)\"`.\n * - All version links have `skipVersioning: true` to prevent further prefixing.\n *\n * This utility allows users to quickly switch between documentation versions\n * from the navigation bar.\n *\n * @example\n * ```ts\n * const themeConfig: VersionsConfigInterface = {\n * versionSwitcher: { text: \"Versions\", includeCurrentVersion: true }\n * };\n *\n * const versions = [\"v2.0.0\", \"v1.5.0\"];\n * const navItem = versionSwitcher(themeConfig, versions, \"v2.0.0\");\n *\n * // \u2192 {\n * // text: \"Versions\",\n * // items: [\n * // { link: \"/\", text: \"v2.0.0 (latest)\", skipVersioning: true },\n * // { link: \"/v2.0.0/\", text: \"v2.0.0\", skipVersioning: true },\n * // { link: \"/v1.5.0/\", text: \"v1.5.0\", skipVersioning: true }\n * // ]\n * // }\n * ```\n *\n * @since 2.0.0\n */\n\nexport function versionSwitcher(themeConfig: VersionsConfigInterface, versions: Array<string>, current: string = 'Latest'): undefined | NavItemWithChildrenType {\n if (themeConfig.versionSwitcher === false) return;\n\n const { text, includeCurrentVersion } = themeConfig.versionSwitcher;\n const items = [];\n if (includeCurrentVersion) {\n items.push({\n link: '/',\n text: current === 'Latest' ? current : `${ current } (latest)`,\n skipVersioning: true\n });\n }\n\n for (const version of versions) {\n items.push({ text: version, link: `/${ version }/`, skipVersioning: true });\n }\n\n return { text, items };\n}\n", "/**\n * Imports\n */\n\nimport { join } from 'path/posix';\nimport { StateModel } from '@models/state.model';\nimport { inject } from '@symlinks/services/inject.service';\n\n/**\n * Populates locale information in the VitePress configuration for all versions.\n *\n * @remarks\n * - Reads the `localesMap` from the `StateModel` to identify each user-defined locale.\n * - Copies `lang` and `label` from the user configuration into `vitepressConfig.locales`.\n * - For each version in `versionsList`, creates a versioned locale entry in `vitepressConfig.locales`.\n * - Ensures that both the root locale and versioned locales have proper `lang` and `label` settings.\n *\n * @example\n * ```ts\n * parseLocale();\n * console.log(state.vitepressConfig.locales);\n * // \u2192 { root: { lang: \"en\", label: \"English\" }, \"1.0/en\": { lang: \"en\" }, ... }\n * ```\n *\n * @since 2.0.0\n */\n\nexport function parseLocale(): void {\n const state = inject(StateModel);\n const versions = state.versionsList;\n const locales = state.vitepressConfig.locales;\n const userLocales = state.configuration.locales;\n\n for (const key of Object.keys(state.localesMap)) {\n const index = state.localesMap[key];\n const isRoot = index === 'root';\n const localeObject = 'root' in userLocales ? userLocales[index] : userLocales[key];\n const localeItems = { ...localeObject, themeConfig: undefined };\n\n locales[index] ??= {};\n Object.assign(locales[index], localeItems);\n\n if(isRoot) locales[index].link = '/';\n else locales[index].link = `/${ locales[index].lang }/`;\n\n for (const version of versions) {\n const subIndex = isRoot ? version : join(key, version);\n locales[subIndex] ??= {};\n Object.assign(locales[subIndex], { ...localeItems });\n\n locales[subIndex].label = ' ';\n if(isRoot) locales[subIndex].link = '/';\n else locales[subIndex].link = `/${ locales[subIndex].lang }/`;\n }\n }\n}\n", "/**\n * Import will remove at compile time\n */\n\nimport type { SidebarItemType, SidebarObjectType, SidebarType } from '@interfaces/sidebar.interface';\n\n/**\n * Imports\n */\n\nimport { join } from 'path/posix';\nimport { StateModel } from '@models/state.model';\nimport { inject } from '@symlinks/services/inject.service';\n\n/**\n * Populates sidebar items with versioned base paths.\n *\n * @param sidebar - The list of sidebar {@link SidebarItemType} items to transform.\n * @param version - The version key (e.g., `\"en\"`, `\"v1.0\"`, `\"root\"`).\n *\n * @returns A new sidebar array with versioned `base` properties applied.\n *\n * @remarks\n * - If the provided `version` is `\"root\"`, it is normalized to an empty prefix (`\"\"`).\n * - Items marked with `skipVersioning` are returned unchanged.\n * - When an item has a `link` or nested `items`, its `base` property is updated with the version prefix.\n * - Recursively processes child `items` to ensure consistent versioning throughout the sidebar tree.\n *\n * @example\n * ```ts\n * const sidebar: SidebarItemType[] = [\n * { text: \"Introduction\", link: \"/intro\" },\n * {\n * text: \"Guide\",\n * items: [\n * { text: \"Setup\", link: \"/setup\" }\n * ]\n * }\n * ];\n *\n * // Applying version \"v1\"\n * const result = populateSidebar(sidebar, \"v1\");\n *\n * // Result:\n * [\n * { text: \"Introduction\", link: \"/intro\", base: \"/v1/\" },\n * {\n * text: \"Guide\",\n * base: \"/v1/\",\n * items: [\n * { text: \"Setup\", link: \"/setup\", base: \"/v1/\" }\n * ]\n * }\n * ]\n * ```\n *\n * @see SidebarItemType\n * @since 2.0.0\n */\n\nexport function populateSidebar(sidebar: Array<SidebarItemType>, version: string): Array<SidebarItemType> {\n if (version === 'root') version = '';\n\n return sidebar.map(item => {\n if(item.skipVersioning) return item;\n item = { ...item };\n\n if((item.link || item.items) && version !== '') {\n item.base ??= '';\n item.base = join('/', version, item.base, '/');\n }\n\n return item;\n });\n}\n\n/**\n * Normalizes a sidebar definition into a flat {@link SidebarObjectType} structure.\n *\n * @param results - The target results object where normalized sidebar items will be accumulated.\n * @param sidebar - The sidebar definition to normalize, which can be an array of items or a path-based mapping.\n * @param prefix - The optional path prefix used for nested sidebar entries (defaults to `\"\"`).\n * @param root - A root-level sidebar object used as a fallback when merging items (defaults to `{}`).\n *\n * @returns void \u2014 Mutates the `results` object directly by appending normalized sidebar items.\n *\n * @remarks\n * - If the `sidebar` is an array, it is stored under the `prefix` key (or `\"root\"` if no prefix is given).\n * - If the `sidebar` is an object, each key is resolved into a full index path using the `prefix`.\n * - When merging items, entries from `root` (matching key or `\"root\"`) are prepended to the results.\n * - Ensures all sidebar values are normalized into arrays, even if a single item is provided.\n *\n * @example\n * ```ts\n * const results: SidebarObjectType = {};\n * normalizeSidebar(results, [\n * { text: \"Intro\", link: \"/intro\" }\n * ]);\n *\n * // Result:\n * {\n * root: [\n * { text: \"Intro\", link: \"/intro\" }\n * ]\n * }\n * ```\n *\n * @example\n * ```ts\n * const results: SidebarObjectType = {};\n * normalizeSidebar(results, {\n * guide: [\n * { text: \"Getting Started\", link: \"/guide/start\" }\n * ]\n * }, \"en\");\n *\n * // Result:\n * {\n * \"en/guide\": [\n * { text: \"Getting Started\", link: \"/guide/start\" }\n * ]\n * }\n * ```\n *\n * @see SidebarType\n * @see SidebarObjectType\n *\n * @since 2.0.0\n */\n\nexport function normalizeSidebar(results: SidebarObjectType, sidebar: SidebarType, prefix: string = '', root: SidebarObjectType = {}): void {\n if (Array.isArray(sidebar)) {\n const index = prefix ? prefix : 'root';\n results[index] ??= [];\n\n if (root[index]) results[index].push(...root[index]);\n else if (root.root) results[index].push(...root.root);\n results[index].push(...sidebar);\n\n return;\n }\n\n for (const [ key, items ] of Object.entries(sidebar)) {\n const subRoot = key === 'root' && prefix === '' ? 'root' : prefix;\n const index = key === 'root' ? subRoot : join(prefix, key);\n const itemsArray = Array.isArray(items) ? items : [ items ];\n results[index] ??= [];\n\n if (root[key]) results[index].push(...root[key]);\n else if (root.root) results[index].push(...root.root);\n results[index].push(...itemsArray);\n }\n}\n\n/**\n * Normalizes all sidebar structures across global and locale-specific configurations.\n *\n * @param state - The current {@link StateModel} providing configuration data:\n * - `configuration.themeConfig.sidebar` \u2014 global sidebar configuration.\n * - `configuration.locales` \u2014 locale-specific configurations with optional `sidebar`.\n * - `localesMap` \u2014 maps locale keys to normalized paths for root fallback.\n *\n * @returns A flat {@link SidebarObjectType} where each key corresponds to a locale\n * or `\"root\"` and contains an array of normalized sidebar items.\n *\n * @remarks\n * - Global sidebar items are first normalized into `globalResults`.\n * - If no locales are defined, `globalResults` is returned directly.\n * - For each locale:\n * - Computes a `prefix` key for the locale (falling back to `\"root\"` if necessary).\n * - Normalizes the locale\u2019s sidebar using {@link normalizeSidebar}, merging in global items as fallback.\n * - Ensures that all sidebar entries are flattened and ready for versioning or rendering.\n *\n * @example\n * ```ts\n * const state = inject(StateModel);\n * const sidebars = normalizeSidebars(state);\n * // sidebars \u2192 {\n * // root: [...global items],\n * // en: [...English locale items including global fallback],\n * // fr: [...French locale items including global fallback]\n * // }\n * ```\n *\n * @see SidebarType\n * @see normalizeSidebar\n * @see SidebarObjectType\n *\n * @since 2.0.0\n */\n\nexport function normalizeSidebars(state: StateModel): SidebarObjectType {\n const locales = state.configuration.locales;\n const localesKeys = Object.keys(locales);\n const globalResults: SidebarObjectType = { root: [] };\n\n if (state.configuration.themeConfig?.sidebar) {\n normalizeSidebar(globalResults, state.configuration.themeConfig.sidebar as SidebarType);\n }\n\n if (!localesKeys.length) return globalResults;\n const results: SidebarObjectType = { root: [] };\n\n for (const locale of localesKeys) {\n const prefix = locale === 'root' || state.localesMap[locale] === 'root' ? 'root' : locale;\n normalizeSidebar(results, (locales[locale].themeConfig?.sidebar ?? []) as SidebarType, prefix, globalResults);\n }\n\n return results;\n}\n\n/**\n * Parses and populates the sidebar structure for all locales.\n *\n * @remarks\n * - Retrieves normalized sidebar items using {@link normalizeSidebars}.\n * - Iterates through all locales defined in `vitepressConfig.locales`.\n * - For each locale:\n * - Falls back to global sidebar (`sidebars.root`) if locale-specific sidebar is not defined.\n * - Ensures the locale\u2019s `themeConfig` exists.\n * - Populates the locale\u2019s `themeConfig.sidebar` using {@link populateSidebar}, applying versioning where applicable.\n *\n * This function ensures that all locales have a fully initialized and version-aware sidebar structure.\n *\n * @example\n * ```ts\n * parseSidebar();\n * // state.vitepressConfig.locales \u2192 each locale has `themeConfig.sidebar` populated\n * ```\n *\n * @see SidebarType\n * @see populateSidebar\n * @see SidebarObjectType\n * @see normalizeSidebars\n *\n * @since 2.0.0\n */\n\nexport function parseSidebar(): void {\n const state = inject(StateModel);\n const { vitepressConfig: { locales } } = state;\n const sidebars = normalizeSidebars(state);\n\n for (const [ key, locale ] of Object.entries(locales)) {\n const sidebar = sidebars[key] ?? sidebars.root;\n\n locale.themeConfig ??= {};\n locale.themeConfig.sidebar = populateSidebar(sidebar, key);\n }\n}\n", "/**\n * Import will remove at compile time\n */\n\nimport type { UserConfig } from 'vitepress';\nimport type { PartialConfigurationType } from '@interfaces/configuration.interface';\n\n/**\n * Imports\n */\n\nimport { StateModel } from '@models/state.model';\nimport { parseNavs } from '@components/nav.component';\nimport { deepMerge } from '@components/object.component';\nimport { parseLocale } from '@components/locale.component';\nimport { parseSidebar } from '@components/sidebar.component';\nimport { forceInject } from '@symlinks/services/inject.service';\nimport { parseRoutesComponent } from '@components/rewrites.component';\nimport { defaultConfiguration } from '@constants/configuration.constant';\n\n/**\n * Export interfaces\n */\n\nexport type * from 'vitepress';\nexport type * from '@interfaces/nav.interface';\nexport type * from '@interfaces/theme.interface';\nexport type * from '@interfaces/locale.interface';\nexport type * from '@interfaces/sidebar.interface';\nexport type * from '@interfaces/configuration.interface';\n\nexport function defineVersionedConfig(userConfiguration: PartialConfigurationType): UserConfig {\n const config = deepMerge(defaultConfiguration, userConfiguration);\n const state = forceInject(StateModel, config).init();\n parseLocale();\n\n /**\n * Parse components\n */\n\n parseNavs();\n parseSidebar();\n parseRoutesComponent();\n\n return <UserConfig> state.vitepressConfig;\n}\n"],
6
+ "mappings": "2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AKQ,CAAO,IAAK,OAAO,QAAQH,CAAO,EAAG,CACnD,IAAMf,EAAUsB,EAASZ,CAAG,GAAKY,EAAS,KAE1CJ,EAAO,cAAgB,CAAC,EACxBA,EAAO,YAAY,QAAUnB,GAAgBC,EAASU,CAAG,CAC7D,CACJ,CAXgBN,EAAAe,EAAA,gBC/MT,SAASI,GAAsBC,EAAyD,CAC3F,IAAMC,EAASC,EAAUC,EAAsBH,CAAiB,EAC1DI,EAAQC,EAAYC,EAAYL,CAAM,EAAE,KAAK,EACnD,OAAAM,EAAY,EAMZC,EAAU,EACVC,EAAa,EACbC,EAAqB,EAEDN,EAAM,eAC9B,CAdgBO,EAAAZ,GAAA",
7
+ "names": ["join", "posix", "xterm", "SINGLETONS", "INJECTABLES", "isProviderUseClass", "provider", "__name", "isProviderUseFactory", "isProviderUseValue", "Injectable", "options", "target", "providersIntoArgs", "providers", "args", "scopeAgs", "inject", "token", "metadata", "instance", "forceInject", "existsSync", "mkdirSync", "readdirSync", "writeFileSync", "join", "rewritesHook", "source", "version", "locale", "join", "__name", "parseRoutesComponent", "result", "state", "inject", "StateModel", "localesPrefix", "folder", "fileList", "prefix", "file", "localeKey", "item", "defaultConfiguration", "rewritesHook", "readdirSync", "join", "relative", "deepMerge", "obj1", "obj2", "result", "key", "val2", "val1", "__name", "getAllMarkdownFilesRelative", "rootDir", "currentDir", "results", "entries", "readdirSync", "entry", "fullPath", "join", "relativePath", "relative", "StateModel", "configuration", "defaultConfiguration", "sources", "archive", "join", "existsSync", "xterm", "subFolders", "readdirSync", "entry", "getAllMarkdownFilesRelative", "folder", "path", "locales", "userLocales", "keys", "rootLocaleKey", "key", "index", "version", "versionPath", "posix", "mkdirSync", "writeFileSync", "result", "exclude", "themeConfig", "prop", "__name", "__decorateClass", "Injectable", "join", "versionSwitcher", "themeConfig", "versions", "current", "text", "includeCurrentVersion", "items", "version", "__name", "isNavItemWithChildren", "item", "__name", "isNavItemWithLink", "replaceLinksRecursive", "version", "child", "join", "populateNav", "items", "state", "inject", "StateModel", "normalizeNav", "results", "nav", "prefix", "root", "index", "key", "normalizeNavs", "locales", "localesKeys", "globalResults", "switcher", "versionSwitcher", "locale", "parseNavs", "navs", "join", "parseLocale", "state", "inject", "StateModel", "versions", "locales", "userLocales", "key", "index", "isRoot", "localeItems", "version", "subIndex", "join", "__name", "join", "populateSidebar", "sidebar", "version", "item", "join", "__name", "normalizeSidebar", "results", "prefix", "root", "index", "key", "items", "itemsArray", "normalizeSidebars", "state", "locales", "localesKeys", "globalResults", "locale", "parseSidebar", "inject", "StateModel", "sidebars", "defineVersionedConfig", "userConfiguration", "config", "deepMerge", "defaultConfiguration", "state", "forceInject", "StateModel", "parseLocale", "parseNavs", "parseSidebar", "parseRoutesComponent", "__name"]
8
8
  }
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "types": "./dist/index.d.ts",
6
6
  "module": "./dist/index.js",
7
7
  "author": "Garefild",
8
- "version": "1.0.0",
8
+ "version": "2.0.1",
9
9
  "license": "Mozilla Public License Version 2.0",
10
10
  "description": "A versioning plugin for VitePress",
11
11
  "homepage": "https://viteplus.github.io/versions/",
@@ -34,11 +34,14 @@
34
34
  ],
35
35
  "scripts": {
36
36
  "dev": "xbuild -w",
37
- "lint": "xbuild --tc && eslint . -c ./eslint.config.mjs",
38
37
  "build": "xbuild",
39
38
  "test": "xjet",
40
39
  "test:coverage": "xjet --coverage",
41
40
  "preci:test": "xbuild",
41
+ "lint": "npm run lint:md && npm run lint:eslint && npm run lint:typescript",
42
+ "lint:md": "markdownlint \"**/*.md\" \".github/**/*.md\" --ignore \"node_modules/**\"",
43
+ "lint:eslint": "eslint . -c ./eslint.config.mjs",
44
+ "lint:typescript": "xbuild --tc",
42
45
  "ci:test": "xjet",
43
46
  "ci:clean": "rm -rf ./dist",
44
47
  "ci:build": "npm run build",
@@ -46,17 +49,27 @@
46
49
  "docs:build": "vitepress build docs",
47
50
  "docs:preview": "vitepress preview docs"
48
51
  },
52
+ "dependencies": {
53
+ "vitepress": "^2.0.0-alpha.12",
54
+ "@remotex-labs/xansi": "^1.3.2"
55
+ },
49
56
  "devDependencies": {
50
57
  "eslint": "^9.35.0",
51
- "typescript-eslint": "^8.44.0",
58
+ "markdownlint-cli": "^0.45.0",
59
+ "typescript-eslint": "^8.44.1",
52
60
  "eslint-plugin-tsdoc": "^0.4.0",
53
61
  "eslint-plugin-perfectionist": "^4.15.0",
54
62
  "@types/node": "^24.5.0",
55
- "@remotex-labs/xjet": "^1.0.1",
63
+ "@viteplus/versions": "^2.0.0",
64
+ "@remotex-labs/xjet": "^1.1.0",
56
65
  "@remotex-labs/xbuild": "1.6.0"
57
66
  },
58
67
  "peerDependencies": {
59
- "vitepress": "^1.6.4",
60
- "@remotex-labs/xansi": "^1.3.2"
68
+ "vitepress": "^1.6.4"
69
+ },
70
+ "peerDependenciesMeta": {
71
+ "vitepress": {
72
+ "optional": true
73
+ }
61
74
  }
62
75
  }