@codemonster-ru/vue-ssg-core 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +5 -2
- package/dist/index.js +33 -8
- package/dist/index.js.map +1 -1
- package/dist/playground.d.ts +38 -0
- package/dist/playground.js +175 -0
- package/dist/playground.js.map +1 -0
- package/package.json +8 -4
package/dist/index.d.ts
CHANGED
|
@@ -159,12 +159,15 @@ type DocsContentBlock = {
|
|
|
159
159
|
language: string;
|
|
160
160
|
} | {
|
|
161
161
|
type: 'playground';
|
|
162
|
-
files
|
|
163
|
-
entry
|
|
162
|
+
files?: Record<string, string>;
|
|
163
|
+
entry?: string;
|
|
164
164
|
framework?: DocsPlaygroundFramework;
|
|
165
165
|
autorun?: boolean;
|
|
166
166
|
showCode?: boolean;
|
|
167
167
|
height?: number | string;
|
|
168
|
+
demoId?: string;
|
|
169
|
+
demoImport?: string;
|
|
170
|
+
renderMode?: 'sandbox' | 'vue-module' | 'component';
|
|
168
171
|
} | {
|
|
169
172
|
type: 'list';
|
|
170
173
|
ordered: boolean;
|
package/dist/index.js
CHANGED
|
@@ -273,6 +273,8 @@ function parsePlaygroundSourceHeader(text, sourcePath) {
|
|
|
273
273
|
const framework = frameworkRaw || "vanilla";
|
|
274
274
|
const heightRaw = metadata.get("height");
|
|
275
275
|
const entry = metadata.get("entry");
|
|
276
|
+
const modeRaw = metadata.get("mode");
|
|
277
|
+
const renderMode = modeRaw === "component" ? "component" : "sandbox";
|
|
276
278
|
if (!entry) {
|
|
277
279
|
throw new Error(`[docs] Invalid playground-src in ${sourcePath}: "entry" is required`);
|
|
278
280
|
}
|
|
@@ -289,7 +291,8 @@ function parsePlaygroundSourceHeader(text, sourcePath) {
|
|
|
289
291
|
return {
|
|
290
292
|
framework,
|
|
291
293
|
entry,
|
|
292
|
-
height
|
|
294
|
+
height,
|
|
295
|
+
renderMode
|
|
293
296
|
};
|
|
294
297
|
}
|
|
295
298
|
function parsePlaygroundSourcePayload(rawSource, sourcePath) {
|
|
@@ -315,7 +318,7 @@ function parsePlaygroundSourcePayload(rawSource, sourcePath) {
|
|
|
315
318
|
if (!metadataToken) {
|
|
316
319
|
throw new Error(`[docs] Invalid playground-src in ${sourcePath}: missing header metadata`);
|
|
317
320
|
}
|
|
318
|
-
const { framework, height, entry } = parsePlaygroundSourceHeader(metadataToken.text, sourcePath);
|
|
321
|
+
const { framework, height, entry, renderMode } = parsePlaygroundSourceHeader(metadataToken.text, sourcePath);
|
|
319
322
|
const files = {};
|
|
320
323
|
for (const codeToken of codeTokens) {
|
|
321
324
|
const lang = codeToken.lang?.trim() ?? "";
|
|
@@ -338,7 +341,8 @@ function parsePlaygroundSourcePayload(rawSource, sourcePath) {
|
|
|
338
341
|
files,
|
|
339
342
|
entry,
|
|
340
343
|
framework,
|
|
341
|
-
height
|
|
344
|
+
height,
|
|
345
|
+
renderMode
|
|
342
346
|
};
|
|
343
347
|
}
|
|
344
348
|
function isStringRecord(value) {
|
|
@@ -358,8 +362,10 @@ function parsePlaygroundPayload(rawSource) {
|
|
|
358
362
|
return null;
|
|
359
363
|
}
|
|
360
364
|
const data = parsed;
|
|
361
|
-
const files = isStringRecord(data.files) ? data.files :
|
|
362
|
-
|
|
365
|
+
const files = isStringRecord(data.files) ? data.files : void 0;
|
|
366
|
+
const demoId = typeof data.demoId === "string" && data.demoId.trim() ? data.demoId.trim() : void 0;
|
|
367
|
+
const demoImport = typeof data.demoImport === "string" && data.demoImport.trim() ? data.demoImport.trim() : void 0;
|
|
368
|
+
if ((!files || Object.keys(files).length === 0) && !demoId && !demoImport) {
|
|
363
369
|
return null;
|
|
364
370
|
}
|
|
365
371
|
return {
|
|
@@ -368,7 +374,9 @@ function parsePlaygroundPayload(rawSource) {
|
|
|
368
374
|
framework: data.framework === "vanilla" || data.framework === "vue" || data.framework === "html" ? data.framework : void 0,
|
|
369
375
|
autorun: typeof data.autorun === "boolean" ? data.autorun : void 0,
|
|
370
376
|
showCode: typeof data.showCode === "boolean" ? data.showCode : void 0,
|
|
371
|
-
height: typeof data.height === "number" || typeof data.height === "string" ? data.height : void 0
|
|
377
|
+
height: typeof data.height === "number" || typeof data.height === "string" ? data.height : void 0,
|
|
378
|
+
demoId,
|
|
379
|
+
demoImport
|
|
372
380
|
};
|
|
373
381
|
}
|
|
374
382
|
function parsePlaygroundCodeBlock(token) {
|
|
@@ -380,6 +388,21 @@ function parsePlaygroundCodeBlock(token) {
|
|
|
380
388
|
if (!payload) {
|
|
381
389
|
return null;
|
|
382
390
|
}
|
|
391
|
+
if (payload.demoId || payload.demoImport) {
|
|
392
|
+
return {
|
|
393
|
+
type: "playground",
|
|
394
|
+
framework: payload.framework ?? "vue",
|
|
395
|
+
autorun: payload.autorun,
|
|
396
|
+
showCode: payload.showCode,
|
|
397
|
+
height: payload.height,
|
|
398
|
+
demoId: payload.demoId,
|
|
399
|
+
demoImport: payload.demoImport,
|
|
400
|
+
renderMode: "vue-module"
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
if (!payload.files || Object.keys(payload.files).length === 0) {
|
|
404
|
+
return null;
|
|
405
|
+
}
|
|
383
406
|
const entry = payload.entry && payload.files[payload.entry] ? payload.entry : Object.keys(payload.files)[0];
|
|
384
407
|
return {
|
|
385
408
|
type: "playground",
|
|
@@ -388,7 +411,8 @@ function parsePlaygroundCodeBlock(token) {
|
|
|
388
411
|
framework: payload.framework,
|
|
389
412
|
autorun: payload.autorun,
|
|
390
413
|
showCode: payload.showCode,
|
|
391
|
-
height: payload.height
|
|
414
|
+
height: payload.height,
|
|
415
|
+
renderMode: "sandbox"
|
|
392
416
|
};
|
|
393
417
|
}
|
|
394
418
|
function parsePlaygroundSourceCodeBlock(token, sourcePath) {
|
|
@@ -402,7 +426,8 @@ function parsePlaygroundSourceCodeBlock(token, sourcePath) {
|
|
|
402
426
|
files: payload.files,
|
|
403
427
|
entry: payload.entry,
|
|
404
428
|
framework: payload.framework,
|
|
405
|
-
height: payload.height
|
|
429
|
+
height: payload.height,
|
|
430
|
+
renderMode: payload.renderMode ?? "sandbox"
|
|
406
431
|
};
|
|
407
432
|
}
|
|
408
433
|
function renderMarkdown(markdown, tocLevels, sourcePath) {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/createViteSsgApp.ts","../src/docsContent.ts","../src/routes.ts","../src/config.ts"],"sourcesContent":["import { createHead as createClientHead } from '@unhead/vue/client'\nimport { createHead as createServerHead } from '@unhead/vue/server'\nimport { createApp, createSSRApp, type Component } from 'vue'\nimport {\n createMemoryHistory,\n createRouter,\n createWebHistory,\n type RouteRecordRaw,\n type Router\n} from 'vue-router'\n\ntype CreateViteSsgContext = {\n app: ReturnType<typeof createApp>\n head: ReturnType<typeof createClientHead> | ReturnType<typeof createServerHead> | undefined\n initialState: Record<string, unknown>\n isClient: boolean\n onSSRAppRendered: (cb: () => void | Promise<void>) => void\n routePath?: string\n router: Router\n routes: RouteRecordRaw[]\n transformState?: (state: Record<string, unknown>) => Record<string, unknown>\n triggerOnSSRAppRendered: () => Promise<void[]>\n}\n\ntype CreateViteSsgOptions = {\n hydration?: boolean\n rootContainer?: string\n useHead?: boolean\n transformState?: (state: Record<string, unknown>) => Record<string, unknown>\n}\n\nasync function documentReady(): Promise<void> {\n if (typeof document === 'undefined' || document.readyState !== 'loading') {\n return\n }\n\n await new Promise<void>((resolve) => {\n document.addEventListener('DOMContentLoaded', () => resolve(), { once: true })\n })\n}\n\nasync function nextFrame(): Promise<void> {\n await new Promise<void>((resolve) => requestAnimationFrame(() => resolve()))\n}\n\nfunction isVisibleElement(element: HTMLElement | null): element is HTMLElement {\n return Boolean(element && element.offsetParent !== null)\n}\n\nfunction getStickyOffsetTop(): number {\n if (typeof document === 'undefined') {\n return 0\n }\n\n const header = document.querySelector<HTMLElement>('.vf-document-layout__header')\n const layoutSubheader = document.querySelector<HTMLElement>('.vf-document-layout__subheader')\n const contentSubheader = document.querySelector<HTMLElement>('.vf-document-layout__content-subheader')\n const topGap = 16\n let offset = topGap\n\n if (isVisibleElement(header)) {\n offset += header.getBoundingClientRect().height\n }\n\n if (isVisibleElement(layoutSubheader)) {\n offset += layoutSubheader.getBoundingClientRect().height\n }\n\n if (isVisibleElement(contentSubheader)) {\n offset += contentSubheader.getBoundingClientRect().height\n }\n\n return offset\n}\n\nfunction getInitialState(): Record<string, unknown> {\n if (typeof window === 'undefined') {\n return {}\n }\n\n return ((window as Window & { __INITIAL_STATE__?: Record<string, unknown> }).__INITIAL_STATE__ ?? {})\n}\n\nfunction ensureHistoryState(): void {\n if (typeof window === 'undefined') {\n return\n }\n\n if (window.history.state) {\n return\n }\n\n const current = `${window.location.pathname}${window.location.search}${window.location.hash}`\n\n window.history.replaceState(\n {\n back: null,\n current,\n forward: null,\n position: window.history.length - 1,\n replaced: true,\n scroll: null\n },\n '',\n current\n )\n}\n\nexport function createViteSsgApp(\n App: Component,\n routerOptions: { base?: string; routes: RouteRecordRaw[] },\n fn?: (context: CreateViteSsgContext) => Promise<void> | void,\n options?: CreateViteSsgOptions\n) {\n const { rootContainer = '#app', transformState, useHead = true } = options ?? {}\n\n async function createSsgApp(routePath?: string): Promise<CreateViteSsgContext> {\n const app = import.meta.env.SSR || options?.hydration ? createSSRApp(App) : createApp(App)\n let head: CreateViteSsgContext['head']\n\n if (useHead) {\n head = import.meta.env.SSR ? createServerHead() : createClientHead()\n app.use(head)\n }\n\n const router = createRouter({\n history: import.meta.env.SSR\n ? createMemoryHistory(routerOptions.base)\n : createWebHistory(routerOptions.base),\n scrollBehavior: async (to, _from, savedPosition) => {\n if (savedPosition) {\n return savedPosition\n }\n\n if (to.hash) {\n const targetHash = decodeURIComponent(to.hash)\n\n await nextFrame()\n await nextFrame()\n\n const targetElement = document.querySelector<HTMLElement>(targetHash)\n\n if (targetElement) {\n const top = targetElement.getBoundingClientRect().top + window.scrollY - getStickyOffsetTop()\n\n return {\n left: 0,\n top: Math.max(0, top),\n behavior: 'smooth'\n }\n }\n }\n\n return { left: 0, top: 0 }\n },\n ...routerOptions\n })\n\n const appRenderCallbacks: Array<() => void | Promise<void>> = []\n const onSSRAppRendered = import.meta.env.SSR\n ? (cb: () => void | Promise<void>) => appRenderCallbacks.push(cb)\n : () => undefined\n const triggerOnSSRAppRendered = () => Promise.all(appRenderCallbacks.map((cb) => cb()))\n\n const context: CreateViteSsgContext = {\n app,\n head,\n initialState: {},\n isClient: !import.meta.env.SSR,\n onSSRAppRendered,\n routePath,\n router,\n routes: routerOptions.routes,\n transformState,\n triggerOnSSRAppRendered\n }\n\n if (!import.meta.env.SSR) {\n await documentReady()\n ensureHistoryState()\n context.initialState = transformState?.(getInitialState()) ?? getInitialState()\n }\n\n await fn?.(context)\n app.use(router)\n\n let entryRoutePath: string | undefined\n let isFirstRoute = true\n\n router.beforeEach((to) => {\n if (isFirstRoute || (entryRoutePath && entryRoutePath === to.path)) {\n isFirstRoute = false\n entryRoutePath = to.path\n to.meta.state = context.initialState\n }\n\n return true\n })\n\n if (import.meta.env.SSR) {\n const route = context.routePath ?? '/'\n await router.push(route)\n await router.isReady()\n context.initialState = (router.currentRoute.value.meta.state as Record<string, unknown>) || {}\n }\n\n return context\n }\n\n if (!import.meta.env.SSR) {\n ;(async () => {\n const { app, router } = await createSsgApp()\n await router.isReady()\n app.mount(rootContainer, true)\n })()\n }\n\n return createSsgApp\n}\n","import { Parser, type Tokens, marked } from 'marked'\nimport GithubSlugger from 'github-slugger'\nimport type { VfNavMenuItem, VfTableOfContentsItem } from '@codemonster-ru/vueforge-core'\nimport type {\n DocsComponentsConfig,\n DocsConfig,\n DocsFooterConfig,\n DocsHeaderNavConfig,\n DocsHomeConfig,\n DocsLayoutConfig,\n DocsSiteConfig\n} from './config'\n\nexport type DocsTableAlign = 'left' | 'center' | 'right' | null\nexport type DocsPlaygroundFramework = 'vanilla' | 'vue' | 'html'\n\nexport type DocsContentBlock =\n | {\n type: 'heading'\n depth: 1 | 2 | 3 | 4 | 5 | 6\n id: string\n html: string\n }\n | {\n type: 'paragraph'\n html: string\n }\n | {\n type: 'code'\n code: string\n language: string\n }\n | {\n type: 'playground'\n files: Record<string, string>\n entry: string\n framework?: DocsPlaygroundFramework\n autorun?: boolean\n showCode?: boolean\n height?: number | string\n }\n | {\n type: 'list'\n ordered: boolean\n items: string[]\n }\n | {\n type: 'blockquote'\n html: string\n }\n | {\n type: 'table'\n header: string[]\n rows: string[][]\n align: DocsTableAlign[]\n }\n | {\n type: 'html'\n html: string\n }\n\nexport interface DocsPage {\n id: string\n path: string\n sourcePath: string\n isIndexPage: boolean\n title: string\n navTitle: string\n description?: string\n order: number\n section: string[]\n blocks: DocsContentBlock[]\n tableOfContents: VfTableOfContentsItem[]\n}\n\ninterface Frontmatter {\n title?: string\n navTitle?: string\n description?: string\n order?: number\n}\n\ninterface NavNode {\n label: string\n order: number\n value?: string\n path?: string\n isPage?: boolean\n isIndexPage?: boolean\n children: Map<string, NavNode>\n}\n\ntype TokensList = Tokens.Generic[]\n\nexport interface ResolveDocsContentInput {\n docsConfig: DocsConfig\n markdownFiles: Record<string, string>\n}\n\nexport interface ResolvedDocsContent {\n docsPages: DocsPage[]\n docsSidebar: VfNavMenuItem[]\n docsSite: DocsSiteConfig\n docsLayout: Required<DocsLayoutConfig>\n docsFooter: DocsFooterConfig\n docsHome: Required<DocsHomeConfig>\n docsHeaderNav: Required<DocsHeaderNavConfig>\n docsComponents: DocsComponentsConfig\n docsSiteTitle: string\n docsScrollOffset: number\n getDocsPageByPath: (pathname: string) => DocsPage\n}\n\nfunction parseFrontmatter(source: string): { data: Frontmatter; content: string } {\n if (!source.startsWith('---\\n')) {\n return { data: {}, content: source }\n }\n\n const frontmatterEnd = source.indexOf('\\n---\\n', 4)\n\n if (frontmatterEnd === -1) {\n return { data: {}, content: source }\n }\n\n const rawFrontmatter = source.slice(4, frontmatterEnd)\n const content = source.slice(frontmatterEnd + 5)\n const data: Frontmatter = {}\n\n for (const line of rawFrontmatter.split('\\n')) {\n const separatorIndex = line.indexOf(':')\n\n if (separatorIndex === -1) {\n continue\n }\n\n const key = line.slice(0, separatorIndex).trim()\n const rawValue = line.slice(separatorIndex + 1).trim()\n const normalizedValue = rawValue.replace(/^['\"]|['\"]$/g, '')\n\n if (key === 'order') {\n const numericValue = Number(normalizedValue)\n data.order = Number.isFinite(numericValue) ? numericValue : 0\n continue\n }\n\n if (key === 'title' || key === 'navTitle' || key === 'description') {\n data[key] = normalizedValue\n }\n }\n\n return { data, content }\n}\n\nfunction toTitleCase(value: string): string {\n return value\n .replace(/[-_]/g, ' ')\n .replace(/\\b\\w/g, (letter) => letter.toUpperCase())\n}\n\nfunction normalizeDocPath(sourcePath: string): string {\n const relativePath = sourcePath.replace(/^.*\\/(?:content|docs)\\//, '').replace(/\\.md$/, '')\n\n if (relativePath === 'index') {\n return '/'\n }\n\n if (relativePath.endsWith('/index')) {\n return `/${relativePath.replace(/\\/index$/, '')}`\n }\n\n return `/${relativePath}`\n}\n\nfunction isIndexSourcePath(sourcePath: string): boolean {\n return sourcePath.replace(/\\\\/g, '/').replace(/\\.md$/, '').endsWith('/index')\n}\n\nfunction normalizeMarkdownLinkHref(href: string): string {\n if (\n href.startsWith('#') ||\n href.startsWith('//') ||\n /^[a-z][a-z\\d+.-]*:/i.test(href)\n ) {\n return href\n }\n\n const match = href.match(/^([^?#]*)([?#].*)?$/)\n\n if (!match) {\n return href\n }\n\n const [, pathname, suffix = ''] = match\n\n if (!/\\.(?:md|mdx)$/i.test(pathname)) {\n return href\n }\n\n const extensionlessPathname = pathname.replace(/\\.(?:md|mdx)$/i, '')\n let normalizedPathname = extensionlessPathname\n\n if (extensionlessPathname === 'index' || extensionlessPathname === './index') {\n normalizedPathname = '.'\n } else if (extensionlessPathname.endsWith('/index')) {\n normalizedPathname = extensionlessPathname.replace(/\\/index$/, '')\n }\n\n return `${normalizedPathname}${suffix}`\n}\n\nfunction normalizeMarkdownLinks(tokens: TokensList): void {\n for (const token of tokens) {\n if (token.type === 'link' && typeof token.href === 'string') {\n token.href = normalizeMarkdownLinkHref(token.href)\n }\n\n if ('tokens' in token && Array.isArray(token.tokens)) {\n normalizeMarkdownLinks(token.tokens as TokensList)\n }\n\n if (token.type === 'list' && Array.isArray(token.items)) {\n for (const item of token.items) {\n normalizeMarkdownLinks(item.tokens as TokensList)\n }\n }\n }\n}\n\nfunction toValueFromPath(path: string): string {\n return path === '/' ? 'index' : path.replace(/^\\//, '').replace(/\\//g, '-')\n}\n\nfunction renderInline(tokens: Tokens.Generic[] | undefined): string {\n return Parser.parseInline(tokens ?? [])\n}\n\nfunction renderBlockTokens(tokens: TokensList | undefined): string {\n return Parser.parse(tokens ?? [])\n}\n\nfunction renderListItemTokens(tokens: TokensList | undefined): string {\n return Parser.parse(tokens ?? [])\n}\n\nfunction normalizeTableAlign(align: Array<string | null | undefined>): DocsTableAlign[] {\n return align.map((value) => {\n if (value === 'left' || value === 'center' || value === 'right') {\n return value\n }\n\n return null\n })\n}\n\ninterface PlaygroundPayload {\n files: Record<string, string>\n entry?: string\n framework?: DocsPlaygroundFramework\n autorun?: boolean\n showCode?: boolean\n height?: number | string\n}\n\ninterface PlaygroundSrcPayload {\n files: Record<string, string>\n entry: string\n framework?: DocsPlaygroundFramework\n height?: number\n}\n\nfunction parsePlaygroundSourceHeader(text: string, sourcePath: string): {\n framework?: DocsPlaygroundFramework\n height?: number\n entry: string\n} {\n const lines = text\n .split('\\n')\n .map((line) => line.trim())\n .filter(Boolean)\n const metadata = new Map<string, string>()\n\n for (const line of lines) {\n const separatorIndex = line.indexOf(':')\n\n if (separatorIndex === -1) {\n throw new Error(`[docs] Invalid playground-src in ${sourcePath}: expected \"key: value\", got \"${line}\"`)\n }\n\n const key = line.slice(0, separatorIndex).trim()\n const value = line.slice(separatorIndex + 1).trim()\n\n metadata.set(key, value)\n }\n\n const frameworkRaw = metadata.get('framework')\n const framework = frameworkRaw || 'vanilla'\n const heightRaw = metadata.get('height')\n const entry = metadata.get('entry')\n\n if (!entry) {\n throw new Error(`[docs] Invalid playground-src in ${sourcePath}: \"entry\" is required`)\n }\n\n if (framework !== 'vanilla' && framework !== 'vue' && framework !== 'html') {\n throw new Error(`[docs] Invalid playground-src in ${sourcePath}: unsupported framework \"${framework}\"`)\n }\n\n let height: number | undefined\n\n if (heightRaw !== undefined) {\n height = Number(heightRaw)\n\n if (!Number.isFinite(height)) {\n throw new Error(`[docs] Invalid playground-src in ${sourcePath}: \"height\" must be a number`)\n }\n }\n\n return {\n framework,\n entry,\n height\n }\n}\n\nfunction parsePlaygroundSourcePayload(rawSource: string, sourcePath: string): PlaygroundSrcPayload {\n const nestedTokens = marked.lexer(rawSource) as TokensList\n let metadataToken: Tokens.Paragraph | null = null\n const codeTokens: Tokens.Code[] = []\n\n for (const token of nestedTokens) {\n if (token.type === 'space') {\n continue\n }\n\n if (!metadataToken) {\n if (token.type !== 'paragraph') {\n throw new Error(`[docs] Invalid playground-src in ${sourcePath}: header metadata must be the first block`)\n }\n\n metadataToken = token as Tokens.Paragraph\n continue\n }\n\n if (token.type !== 'code') {\n throw new Error(`[docs] Invalid playground-src in ${sourcePath}: only code fences are allowed after header`)\n }\n\n codeTokens.push(token as Tokens.Code)\n }\n\n if (!metadataToken) {\n throw new Error(`[docs] Invalid playground-src in ${sourcePath}: missing header metadata`)\n }\n\n const { framework, height, entry } = parsePlaygroundSourceHeader(metadataToken.text, sourcePath)\n const files: Record<string, string> = {}\n\n for (const codeToken of codeTokens) {\n const lang = codeToken.lang?.trim() ?? ''\n const fileMatch = lang.match(/(?:^|\\s)file=([^\\s]+)/)\n\n if (!fileMatch?.[1]) {\n throw new Error(`[docs] Invalid playground-src in ${sourcePath}: each code fence must define \"file=/path\"`)\n }\n\n const filePath = fileMatch[1]\n const content = codeToken.text.endsWith('\\n') ? codeToken.text : `${codeToken.text}\\n`\n files[filePath] = content\n }\n\n if (Object.keys(files).length === 0) {\n throw new Error(`[docs] Invalid playground-src in ${sourcePath}: at least one file fence is required`)\n }\n\n if (!files[entry]) {\n throw new Error(`[docs] Invalid playground-src in ${sourcePath}: entry \"${entry}\" is not present in files`)\n }\n\n return {\n files,\n entry,\n framework,\n height\n }\n}\n\nfunction isStringRecord(value: unknown): value is Record<string, string> {\n if (!value || typeof value !== 'object' || Array.isArray(value)) {\n return false\n }\n\n return Object.values(value).every((entry) => typeof entry === 'string')\n}\n\nfunction parsePlaygroundPayload(rawSource: string): PlaygroundPayload | null {\n let parsed: unknown\n\n try {\n parsed = JSON.parse(rawSource)\n } catch {\n return null\n }\n\n if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {\n return null\n }\n\n const data = parsed as {\n files?: unknown\n entry?: unknown\n framework?: unknown\n autorun?: unknown\n showCode?: unknown\n height?: unknown\n }\n\n const files = isStringRecord(data.files) ? data.files : null\n\n if (!files || Object.keys(files).length === 0) {\n return null\n }\n\n return {\n files,\n entry: typeof data.entry === 'string' ? data.entry : undefined,\n framework:\n data.framework === 'vanilla' || data.framework === 'vue' || data.framework === 'html'\n ? data.framework\n : undefined,\n autorun: typeof data.autorun === 'boolean' ? data.autorun : undefined,\n showCode: typeof data.showCode === 'boolean' ? data.showCode : undefined,\n height:\n typeof data.height === 'number' || typeof data.height === 'string' ? data.height : undefined\n }\n}\n\nfunction parsePlaygroundCodeBlock(token: Tokens.Code): DocsContentBlock | null {\n const language = token.lang?.trim().toLowerCase()\n\n if (language !== 'playground' && language !== 'vf-playground') {\n return null\n }\n\n const payload = parsePlaygroundPayload(token.text)\n\n if (!payload) {\n return null\n }\n\n const entry = payload.entry && payload.files[payload.entry]\n ? payload.entry\n : Object.keys(payload.files)[0]\n\n return {\n type: 'playground',\n files: payload.files,\n entry,\n framework: payload.framework,\n autorun: payload.autorun,\n showCode: payload.showCode,\n height: payload.height\n }\n}\n\nfunction parsePlaygroundSourceCodeBlock(token: Tokens.Code, sourcePath: string): DocsContentBlock | null {\n const language = token.lang?.trim().toLowerCase()\n\n if (language !== 'playground-src' && language !== 'vf-playground-src') {\n return null\n }\n\n const payload = parsePlaygroundSourcePayload(token.text, sourcePath)\n\n return {\n type: 'playground',\n files: payload.files,\n entry: payload.entry,\n framework: payload.framework,\n height: payload.height\n }\n}\n\nfunction renderMarkdown(markdown: string, tocLevels: Set<number>, sourcePath: string): {\n blocks: DocsContentBlock[]\n tableOfContents: VfTableOfContentsItem[]\n} {\n const tokens = marked.lexer(markdown) as TokensList\n normalizeMarkdownLinks(tokens)\n const headingSlugger = new GithubSlugger()\n const tableOfContents: VfTableOfContentsItem[] = []\n const blocks: DocsContentBlock[] = []\n\n for (const token of tokens) {\n switch (token.type) {\n case 'space':\n break\n case 'heading': {\n const id = headingSlugger.slug(token.text)\n const html = renderInline(token.tokens)\n\n blocks.push({\n type: 'heading',\n depth: token.depth as 1 | 2 | 3 | 4 | 5 | 6,\n id,\n html\n })\n\n if (tocLevels.has(token.depth)) {\n tableOfContents.push({\n id,\n label: token.text,\n level: token.depth - 1\n })\n }\n break\n }\n case 'paragraph':\n blocks.push({\n type: 'paragraph',\n html: renderInline(token.tokens)\n })\n break\n case 'code':\n {\n const playgroundSourceBlock = parsePlaygroundSourceCodeBlock(token as Tokens.Code, sourcePath)\n\n if (playgroundSourceBlock) {\n blocks.push(playgroundSourceBlock)\n break\n }\n\n const playgroundBlock = parsePlaygroundCodeBlock(token as Tokens.Code)\n\n if (playgroundBlock) {\n blocks.push(playgroundBlock)\n break\n }\n }\n blocks.push({\n type: 'code',\n code: token.text,\n language: token.lang?.trim() || 'text'\n })\n break\n case 'list':\n blocks.push({\n type: 'list',\n ordered: token.ordered,\n items: token.items.map((item: Tokens.ListItem) => renderListItemTokens(item.tokens))\n })\n break\n case 'blockquote':\n blocks.push({\n type: 'blockquote',\n html: renderBlockTokens(token.tokens)\n })\n break\n case 'table':\n blocks.push({\n type: 'table',\n header: token.header.map((cell: Tokens.TableCell) => renderInline(cell.tokens)),\n rows: token.rows.map((row: Tokens.TableCell[]) => row.map((cell) => renderInline(cell.tokens))),\n align: normalizeTableAlign(token.align)\n })\n break\n default:\n blocks.push({\n type: 'html',\n html: renderBlockTokens([token])\n })\n break\n }\n }\n\n return { blocks, tableOfContents }\n}\n\nfunction getFirstHeadingText(markdown: string): string | undefined {\n const tokens = marked.lexer(markdown) as TokensList\n const heading = tokens.find((token): token is Tokens.Heading => token.type === 'heading' && token.depth === 1)\n\n return heading?.text.trim() || undefined\n}\n\nfunction parsePage(sourcePath: string, source: string, tocLevels: Set<number>): DocsPage {\n const { data: frontmatter, content } = parseFrontmatter(source)\n const path = normalizeDocPath(sourcePath)\n const pathSegments = path === '/' ? [] : path.replace(/^\\//, '').split('/')\n const isIndexPage = isIndexSourcePath(sourcePath)\n const section = isIndexPage ? pathSegments : pathSegments.slice(0, -1)\n const filename = pathSegments[pathSegments.length - 1] ?? 'index'\n const fallbackTitle = isIndexPage ? (getFirstHeadingText(content) ?? 'Overview') : toTitleCase(filename)\n const title = frontmatter.title?.trim() || fallbackTitle\n const navTitle = frontmatter.navTitle?.trim() || (isIndexPage ? 'Overview' : title)\n const { blocks, tableOfContents } = renderMarkdown(content, tocLevels, sourcePath)\n const id = isIndexPage && path !== '/' ? `${toValueFromPath(path)}-index` : toValueFromPath(path)\n\n return {\n id,\n path,\n sourcePath,\n isIndexPage,\n title,\n navTitle,\n description: frontmatter.description?.trim(),\n order: frontmatter.order ?? 0,\n section,\n blocks,\n tableOfContents\n }\n}\n\nfunction sortNodes(nodes: NavNode[]): NavNode[] {\n return [...nodes].sort((left, right) => {\n if (left.order !== right.order) {\n return left.order - right.order\n }\n\n const leftIndexPriority = left.isIndexPage ? 0 : 1\n const rightIndexPriority = right.isIndexPage ? 0 : 1\n\n if (leftIndexPriority !== rightIndexPriority) {\n return leftIndexPriority - rightIndexPriority\n }\n\n return left.label.localeCompare(right.label)\n })\n}\n\nfunction getPageNavKey(page: DocsPage): string {\n if (page.isIndexPage) {\n return 'index'\n }\n\n return page.path.split('/').filter(Boolean).at(-1) ?? page.id\n}\n\nfunction buildSidebar(pages: DocsPage[], docsConfig: DocsConfig): VfNavMenuItem[] {\n const root = new Map<string, NavNode>()\n\n for (const page of pages) {\n let current = root\n let currentPath = ''\n\n for (const segment of page.section) {\n currentPath = `${currentPath}/${segment}`\n const sectionConfig = docsConfig.sectionLabels?.[segment]\n\n if (!current.has(segment)) {\n current.set(segment, {\n label: sectionConfig?.label ?? toTitleCase(segment),\n order: sectionConfig?.order ?? 1_000,\n value: toValueFromPath(currentPath),\n path: currentPath,\n isPage: false,\n children: new Map()\n })\n }\n\n current = current.get(segment)!.children\n }\n\n const pageKey = getPageNavKey(page)\n const existingPageNode = current.get(pageKey)\n\n current.set(pageKey, {\n label: page.navTitle,\n order: page.order,\n value: page.id,\n path: page.path,\n isPage: true,\n isIndexPage: page.isIndexPage,\n children: existingPageNode?.children ?? new Map()\n })\n }\n\n const toItems = (nodes: Map<string, NavNode>): VfNavMenuItem[] =>\n sortNodes([...nodes.values()]).map((node) => {\n const item: VfNavMenuItem = {\n value: node.value ?? toValueFromPath(node.path ?? node.label),\n label: node.label\n }\n\n const children = toItems(node.children)\n\n if (node.path && node.isPage) {\n item.to = node.path\n }\n\n if (children.length > 0) {\n if (item.to) {\n const branchValue = `${item.value}-section`\n\n item.children = [\n {\n value: item.value,\n label: 'Overview',\n to: item.to\n },\n ...children\n ]\n item.value = branchValue\n delete item.to\n } else {\n item.children = children\n }\n }\n\n return item\n })\n\n return toItems(root)\n}\n\nexport function resolveDocsContent({ docsConfig, markdownFiles }: ResolveDocsContentInput): ResolvedDocsContent {\n const tocLevels = new Set(docsConfig.toc?.levels ?? [2, 3, 4])\n\n const docsPages = Object.entries(markdownFiles)\n .map(([sourcePath, source]) => parsePage(sourcePath, source, tocLevels))\n .filter((page) => page.path !== '/')\n .sort((left, right) => left.path.localeCompare(right.path))\n\n const docsSidebar = buildSidebar(docsPages, docsConfig)\n const docsSite: DocsSiteConfig = {\n title: docsConfig.site?.title ?? docsConfig.title ?? 'docs',\n description: docsConfig.site?.description,\n githubUrl: docsConfig.site?.githubUrl,\n homeTo: docsConfig.site?.homeTo ?? '/',\n favicon: docsConfig.site?.favicon,\n logo: docsConfig.site?.logo,\n logoLabel: docsConfig.site?.logoLabel\n }\n const docsLayout: Required<DocsLayoutConfig> = {\n variant: docsConfig.layout?.variant ?? 'sidebar-content-aside',\n fillViewport: docsConfig.layout?.fillViewport ?? true,\n stickyHeader: docsConfig.layout?.stickyHeader ?? true,\n stickySidebar: docsConfig.layout?.stickySidebar ?? true,\n stickyAside: docsConfig.layout?.stickyAside ?? true,\n edgeNotches: docsConfig.layout?.edgeNotches ?? false,\n hideSidebarOnMobile: docsConfig.layout?.hideSidebarOnMobile ?? true,\n hideAsideOnMobile: docsConfig.layout?.hideAsideOnMobile ?? true\n }\n const docsFooter: DocsFooterConfig = {\n left: docsConfig.footer?.left ?? 'Codemonster documentation',\n right: docsConfig.footer?.right\n }\n const docsHome: Required<DocsHomeConfig> = {\n enabled: docsConfig.home?.enabled ?? true,\n title: docsConfig.home?.title ?? 'Build docs fast',\n description: docsConfig.home?.description ?? 'Write markdown, keep the same UI stack, and ship clean developer docs.',\n showGrid: docsConfig.home?.showGrid ?? true,\n primaryAction: docsConfig.home?.primaryAction ?? {\n label: 'Get Started',\n to: '/guide/installation'\n },\n secondaryAction: docsConfig.home?.secondaryAction ?? {\n label: 'View on GitHub',\n href: docsConfig.site?.githubUrl\n }\n }\n const docsHeaderNav: Required<DocsHeaderNavConfig> = {\n items: docsConfig.headerNav?.items ?? [],\n ariaLabel: docsConfig.headerNav?.ariaLabel ?? 'Header navigation'\n }\n const docsComponents: DocsComponentsConfig = docsConfig.components ?? {}\n const docsSiteTitle = docsSite.title\n const docsScrollOffset = docsConfig.toc?.scrollOffset ?? 96\n\n function getDocsPageByPath(pathname: string): DocsPage {\n const normalizedPath = pathname === '/' ? '/' : pathname.replace(/\\/$/, '')\n\n return docsPages.find((page) => page.path === normalizedPath) ?? docsPages[0]\n }\n\n return {\n docsPages,\n docsSidebar,\n docsSite,\n docsLayout,\n docsFooter,\n docsHome,\n docsHeaderNav,\n docsComponents,\n docsSiteTitle,\n docsScrollOffset,\n getDocsPageByPath\n }\n}\n","import type { Component } from 'vue'\nimport type { RouteRecordRaw } from 'vue-router'\nimport type { DocsPage } from './docsContent'\n\nexport interface CreateDocsRoutesInput {\n docsPages: DocsPage[]\n homeEnabled: boolean\n homeComponent: Component\n pageComponent: Component\n notFoundComponent?: Component\n}\n\nexport function createDocsRoutes({\n docsPages,\n homeEnabled,\n homeComponent,\n pageComponent,\n notFoundComponent\n}: CreateDocsRoutesInput): RouteRecordRaw[] {\n const docsPageRoutes: RouteRecordRaw[] = docsPages.map((page) => ({\n path: page.path,\n name: page.id,\n component: pageComponent\n }))\n\n const docsLandingRoute = [...docsPages].sort((left, right) => {\n if (left.order !== right.order) {\n return left.order - right.order\n }\n\n return left.path.localeCompare(right.path)\n })[0]\n\n const rootRoute: RouteRecordRaw = homeEnabled\n ? {\n path: '/',\n name: 'home',\n component: homeComponent\n }\n : docsLandingRoute\n ? {\n path: '/',\n name: 'home',\n redirect: docsLandingRoute.path\n }\n : {\n path: '/',\n name: 'home',\n component: homeComponent\n }\n\n const routes: RouteRecordRaw[] = [rootRoute, ...docsPageRoutes]\n\n if (notFoundComponent) {\n routes.push({\n path: '/:pathMatch(.*)*',\n name: 'not-found',\n component: notFoundComponent\n })\n }\n\n return routes\n}\n","import type { Component } from 'vue'\nimport type { VfNavMenuItem, VfTableOfContentsItem } from '@codemonster-ru/vueforge-core'\n\nexport interface DocsSectionConfig {\n label?: string\n order?: number\n}\n\nexport interface DocsTocConfig {\n levels?: number[]\n scrollOffset?: number\n}\n\nexport interface DocsSiteLogoConfig {\n src?: string\n component?: Component\n alt?: string\n width?: number | string\n height?: number | string\n}\n\nexport interface DocsHomeActionConfig {\n label: string\n to?: string\n href?: string\n}\n\nexport interface DocsHomeConfig {\n enabled?: boolean\n title?: string\n description?: string\n showGrid?: boolean\n primaryAction?: DocsHomeActionConfig\n secondaryAction?: DocsHomeActionConfig\n}\n\nexport interface DocsHeaderNavConfig {\n items?: VfNavMenuItem[]\n ariaLabel?: string\n}\n\nexport type DocsLayoutVariant =\n | 'content'\n | 'sidebar-content'\n | 'sidebar-content-aside'\n\nexport interface DocsSiteConfig {\n title: string\n description?: string\n githubUrl?: string\n homeTo?: string\n favicon?: string\n logo?: DocsSiteLogoConfig\n logoLabel?: string\n}\n\nexport interface DocsLayoutConfig {\n variant?: DocsLayoutVariant\n fillViewport?: boolean\n stickyHeader?: boolean\n stickySidebar?: boolean\n stickyAside?: boolean\n edgeNotches?: boolean\n hideSidebarOnMobile?: boolean\n hideAsideOnMobile?: boolean\n}\n\nexport interface DocsFooterConfig {\n left?: string\n right?: string\n}\n\nexport interface DocsPageMeta {\n title: string\n path: string\n}\n\nexport interface DocsHeaderProps {\n site: DocsSiteConfig\n}\n\nexport interface DocsBrandProps {\n site: DocsSiteConfig\n}\n\nexport interface DocsFooterProps {\n site: DocsSiteConfig\n}\n\nexport interface DocsHeaderNavProps {\n site: DocsSiteConfig\n items: VfNavMenuItem[]\n activeValue?: string\n}\n\nexport interface DocsSidebarProps {\n site: DocsSiteConfig\n page: DocsPageMeta\n items: VfNavMenuItem[]\n}\n\nexport interface DocsAsideProps {\n site: DocsSiteConfig\n page: DocsPageMeta\n items: VfTableOfContentsItem[]\n}\n\nexport interface DocsLayoutProps {\n site: DocsSiteConfig\n page: DocsPageMeta\n layout: Required<DocsLayoutConfig>\n sidebarItems: VfNavMenuItem[]\n tocItems: VfTableOfContentsItem[]\n}\n\nexport interface DocsComponentsConfig {\n Brand?: Component\n Home?: Component\n Header?: Component\n HeaderNav?: Component\n Footer?: Component\n SidebarTop?: Component\n SidebarBottom?: Component\n AsideTop?: Component\n AsideBottom?: Component\n Layout?: Component\n}\n\nexport interface DocsConfig {\n title?: string\n site?: Partial<DocsSiteConfig>\n home?: DocsHomeConfig\n headerNav?: DocsHeaderNavConfig\n layout?: DocsLayoutConfig\n footer?: DocsFooterConfig\n components?: DocsComponentsConfig\n sectionLabels?: Record<string, DocsSectionConfig>\n toc?: DocsTocConfig\n}\n\nexport function defineDocsConfig(config: DocsConfig): DocsConfig {\n return config\n}\n"],"mappings":";AAAA,SAAS,cAAc,wBAAwB;AAC/C,SAAS,cAAc,wBAAwB;AAC/C,SAAS,WAAW,oBAAoC;AACxD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AAsBP,eAAe,gBAA+B;AAC5C,MAAI,OAAO,aAAa,eAAe,SAAS,eAAe,WAAW;AACxE;AAAA,EACF;AAEA,QAAM,IAAI,QAAc,CAAC,YAAY;AACnC,aAAS,iBAAiB,oBAAoB,MAAM,QAAQ,GAAG,EAAE,MAAM,KAAK,CAAC;AAAA,EAC/E,CAAC;AACH;AAEA,eAAe,YAA2B;AACxC,QAAM,IAAI,QAAc,CAAC,YAAY,sBAAsB,MAAM,QAAQ,CAAC,CAAC;AAC7E;AAEA,SAAS,iBAAiB,SAAqD;AAC7E,SAAO,QAAQ,WAAW,QAAQ,iBAAiB,IAAI;AACzD;AAEA,SAAS,qBAA6B;AACpC,MAAI,OAAO,aAAa,aAAa;AACnC,WAAO;AAAA,EACT;AAEA,QAAM,SAAS,SAAS,cAA2B,6BAA6B;AAChF,QAAM,kBAAkB,SAAS,cAA2B,gCAAgC;AAC5F,QAAM,mBAAmB,SAAS,cAA2B,wCAAwC;AACrG,QAAM,SAAS;AACf,MAAI,SAAS;AAEb,MAAI,iBAAiB,MAAM,GAAG;AAC5B,cAAU,OAAO,sBAAsB,EAAE;AAAA,EAC3C;AAEA,MAAI,iBAAiB,eAAe,GAAG;AACrC,cAAU,gBAAgB,sBAAsB,EAAE;AAAA,EACpD;AAEA,MAAI,iBAAiB,gBAAgB,GAAG;AACtC,cAAU,iBAAiB,sBAAsB,EAAE;AAAA,EACrD;AAEA,SAAO;AACT;AAEA,SAAS,kBAA2C;AAClD,MAAI,OAAO,WAAW,aAAa;AACjC,WAAO,CAAC;AAAA,EACV;AAEA,SAAS,OAAoE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,CAAC;AAEJ,QAAM,YAA4B,cAC9B;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,WAAW;AAAA,EACb,IACA,mBACE;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,UAAU,iBAAiB;AAAA,EAC7B,IACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,WAAW;AAAA,EACb;AAEN,QAAM,SAA2B,CAAC,WAAW,GAAG,cAAc;AAE9D,MAAI,mBAAmB;AACrB,WAAO,KAAK;AAAA,MACV,MAAM;AAAA,MACN,MAAM;AAAA,MACN,WAAW;AAAA,IACb,CAAC;AAAA,EACH;AAEA,SAAO;AACT;;;AC8EO,SAAS,iBAAiB,QAAgC;AAC/D,SAAO;AACT;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/createViteSsgApp.ts","../src/docsContent.ts","../src/routes.ts","../src/config.ts"],"sourcesContent":["import { createHead as createClientHead } from '@unhead/vue/client'\nimport { createHead as createServerHead } from '@unhead/vue/server'\nimport { createApp, createSSRApp, type Component } from 'vue'\nimport {\n createMemoryHistory,\n createRouter,\n createWebHistory,\n type RouteRecordRaw,\n type Router\n} from 'vue-router'\n\ntype CreateViteSsgContext = {\n app: ReturnType<typeof createApp>\n head: ReturnType<typeof createClientHead> | ReturnType<typeof createServerHead> | undefined\n initialState: Record<string, unknown>\n isClient: boolean\n onSSRAppRendered: (cb: () => void | Promise<void>) => void\n routePath?: string\n router: Router\n routes: RouteRecordRaw[]\n transformState?: (state: Record<string, unknown>) => Record<string, unknown>\n triggerOnSSRAppRendered: () => Promise<void[]>\n}\n\ntype CreateViteSsgOptions = {\n hydration?: boolean\n rootContainer?: string\n useHead?: boolean\n transformState?: (state: Record<string, unknown>) => Record<string, unknown>\n}\n\nasync function documentReady(): Promise<void> {\n if (typeof document === 'undefined' || document.readyState !== 'loading') {\n return\n }\n\n await new Promise<void>((resolve) => {\n document.addEventListener('DOMContentLoaded', () => resolve(), { once: true })\n })\n}\n\nasync function nextFrame(): Promise<void> {\n await new Promise<void>((resolve) => requestAnimationFrame(() => resolve()))\n}\n\nfunction isVisibleElement(element: HTMLElement | null): element is HTMLElement {\n return Boolean(element && element.offsetParent !== null)\n}\n\nfunction getStickyOffsetTop(): number {\n if (typeof document === 'undefined') {\n return 0\n }\n\n const header = document.querySelector<HTMLElement>('.vf-document-layout__header')\n const layoutSubheader = document.querySelector<HTMLElement>('.vf-document-layout__subheader')\n const contentSubheader = document.querySelector<HTMLElement>('.vf-document-layout__content-subheader')\n const topGap = 16\n let offset = topGap\n\n if (isVisibleElement(header)) {\n offset += header.getBoundingClientRect().height\n }\n\n if (isVisibleElement(layoutSubheader)) {\n offset += layoutSubheader.getBoundingClientRect().height\n }\n\n if (isVisibleElement(contentSubheader)) {\n offset += contentSubheader.getBoundingClientRect().height\n }\n\n return offset\n}\n\nfunction getInitialState(): Record<string, unknown> {\n if (typeof window === 'undefined') {\n return {}\n }\n\n return ((window as Window & { __INITIAL_STATE__?: Record<string, unknown> }).__INITIAL_STATE__ ?? {})\n}\n\nfunction ensureHistoryState(): void {\n if (typeof window === 'undefined') {\n return\n }\n\n if (window.history.state) {\n return\n }\n\n const current = `${window.location.pathname}${window.location.search}${window.location.hash}`\n\n window.history.replaceState(\n {\n back: null,\n current,\n forward: null,\n position: window.history.length - 1,\n replaced: true,\n scroll: null\n },\n '',\n current\n )\n}\n\nexport function createViteSsgApp(\n App: Component,\n routerOptions: { base?: string; routes: RouteRecordRaw[] },\n fn?: (context: CreateViteSsgContext) => Promise<void> | void,\n options?: CreateViteSsgOptions\n) {\n const { rootContainer = '#app', transformState, useHead = true } = options ?? {}\n\n async function createSsgApp(routePath?: string): Promise<CreateViteSsgContext> {\n const app = import.meta.env.SSR || options?.hydration ? createSSRApp(App) : createApp(App)\n let head: CreateViteSsgContext['head']\n\n if (useHead) {\n head = import.meta.env.SSR ? createServerHead() : createClientHead()\n app.use(head)\n }\n\n const router = createRouter({\n history: import.meta.env.SSR\n ? createMemoryHistory(routerOptions.base)\n : createWebHistory(routerOptions.base),\n scrollBehavior: async (to, _from, savedPosition) => {\n if (savedPosition) {\n return savedPosition\n }\n\n if (to.hash) {\n const targetHash = decodeURIComponent(to.hash)\n\n await nextFrame()\n await nextFrame()\n\n const targetElement = document.querySelector<HTMLElement>(targetHash)\n\n if (targetElement) {\n const top = targetElement.getBoundingClientRect().top + window.scrollY - getStickyOffsetTop()\n\n return {\n left: 0,\n top: Math.max(0, top),\n behavior: 'smooth'\n }\n }\n }\n\n return { left: 0, top: 0 }\n },\n ...routerOptions\n })\n\n const appRenderCallbacks: Array<() => void | Promise<void>> = []\n const onSSRAppRendered = import.meta.env.SSR\n ? (cb: () => void | Promise<void>) => appRenderCallbacks.push(cb)\n : () => undefined\n const triggerOnSSRAppRendered = () => Promise.all(appRenderCallbacks.map((cb) => cb()))\n\n const context: CreateViteSsgContext = {\n app,\n head,\n initialState: {},\n isClient: !import.meta.env.SSR,\n onSSRAppRendered,\n routePath,\n router,\n routes: routerOptions.routes,\n transformState,\n triggerOnSSRAppRendered\n }\n\n if (!import.meta.env.SSR) {\n await documentReady()\n ensureHistoryState()\n context.initialState = transformState?.(getInitialState()) ?? getInitialState()\n }\n\n await fn?.(context)\n app.use(router)\n\n let entryRoutePath: string | undefined\n let isFirstRoute = true\n\n router.beforeEach((to) => {\n if (isFirstRoute || (entryRoutePath && entryRoutePath === to.path)) {\n isFirstRoute = false\n entryRoutePath = to.path\n to.meta.state = context.initialState\n }\n\n return true\n })\n\n if (import.meta.env.SSR) {\n const route = context.routePath ?? '/'\n await router.push(route)\n await router.isReady()\n context.initialState = (router.currentRoute.value.meta.state as Record<string, unknown>) || {}\n }\n\n return context\n }\n\n if (!import.meta.env.SSR) {\n ;(async () => {\n const { app, router } = await createSsgApp()\n await router.isReady()\n app.mount(rootContainer, true)\n })()\n }\n\n return createSsgApp\n}\n","import { Parser, type Tokens, marked } from 'marked'\nimport GithubSlugger from 'github-slugger'\nimport type { VfNavMenuItem, VfTableOfContentsItem } from '@codemonster-ru/vueforge-core'\nimport type {\n DocsComponentsConfig,\n DocsConfig,\n DocsFooterConfig,\n DocsHeaderNavConfig,\n DocsHomeConfig,\n DocsLayoutConfig,\n DocsSiteConfig\n} from './config'\n\nexport type DocsTableAlign = 'left' | 'center' | 'right' | null\nexport type DocsPlaygroundFramework = 'vanilla' | 'vue' | 'html'\n\nexport type DocsContentBlock =\n | {\n type: 'heading'\n depth: 1 | 2 | 3 | 4 | 5 | 6\n id: string\n html: string\n }\n | {\n type: 'paragraph'\n html: string\n }\n | {\n type: 'code'\n code: string\n language: string\n }\n | {\n type: 'playground'\n files?: Record<string, string>\n entry?: string\n framework?: DocsPlaygroundFramework\n autorun?: boolean\n showCode?: boolean\n height?: number | string\n demoId?: string\n demoImport?: string\n renderMode?: 'sandbox' | 'vue-module' | 'component'\n }\n | {\n type: 'list'\n ordered: boolean\n items: string[]\n }\n | {\n type: 'blockquote'\n html: string\n }\n | {\n type: 'table'\n header: string[]\n rows: string[][]\n align: DocsTableAlign[]\n }\n | {\n type: 'html'\n html: string\n }\n\nexport interface DocsPage {\n id: string\n path: string\n sourcePath: string\n isIndexPage: boolean\n title: string\n navTitle: string\n description?: string\n order: number\n section: string[]\n blocks: DocsContentBlock[]\n tableOfContents: VfTableOfContentsItem[]\n}\n\ninterface Frontmatter {\n title?: string\n navTitle?: string\n description?: string\n order?: number\n}\n\ninterface NavNode {\n label: string\n order: number\n value?: string\n path?: string\n isPage?: boolean\n isIndexPage?: boolean\n children: Map<string, NavNode>\n}\n\ntype TokensList = Tokens.Generic[]\n\nexport interface ResolveDocsContentInput {\n docsConfig: DocsConfig\n markdownFiles: Record<string, string>\n}\n\nexport interface ResolvedDocsContent {\n docsPages: DocsPage[]\n docsSidebar: VfNavMenuItem[]\n docsSite: DocsSiteConfig\n docsLayout: Required<DocsLayoutConfig>\n docsFooter: DocsFooterConfig\n docsHome: Required<DocsHomeConfig>\n docsHeaderNav: Required<DocsHeaderNavConfig>\n docsComponents: DocsComponentsConfig\n docsSiteTitle: string\n docsScrollOffset: number\n getDocsPageByPath: (pathname: string) => DocsPage\n}\n\nfunction parseFrontmatter(source: string): { data: Frontmatter; content: string } {\n if (!source.startsWith('---\\n')) {\n return { data: {}, content: source }\n }\n\n const frontmatterEnd = source.indexOf('\\n---\\n', 4)\n\n if (frontmatterEnd === -1) {\n return { data: {}, content: source }\n }\n\n const rawFrontmatter = source.slice(4, frontmatterEnd)\n const content = source.slice(frontmatterEnd + 5)\n const data: Frontmatter = {}\n\n for (const line of rawFrontmatter.split('\\n')) {\n const separatorIndex = line.indexOf(':')\n\n if (separatorIndex === -1) {\n continue\n }\n\n const key = line.slice(0, separatorIndex).trim()\n const rawValue = line.slice(separatorIndex + 1).trim()\n const normalizedValue = rawValue.replace(/^['\"]|['\"]$/g, '')\n\n if (key === 'order') {\n const numericValue = Number(normalizedValue)\n data.order = Number.isFinite(numericValue) ? numericValue : 0\n continue\n }\n\n if (key === 'title' || key === 'navTitle' || key === 'description') {\n data[key] = normalizedValue\n }\n }\n\n return { data, content }\n}\n\nfunction toTitleCase(value: string): string {\n return value\n .replace(/[-_]/g, ' ')\n .replace(/\\b\\w/g, (letter) => letter.toUpperCase())\n}\n\nfunction normalizeDocPath(sourcePath: string): string {\n const relativePath = sourcePath.replace(/^.*\\/(?:content|docs)\\//, '').replace(/\\.md$/, '')\n\n if (relativePath === 'index') {\n return '/'\n }\n\n if (relativePath.endsWith('/index')) {\n return `/${relativePath.replace(/\\/index$/, '')}`\n }\n\n return `/${relativePath}`\n}\n\nfunction isIndexSourcePath(sourcePath: string): boolean {\n return sourcePath.replace(/\\\\/g, '/').replace(/\\.md$/, '').endsWith('/index')\n}\n\nfunction normalizeMarkdownLinkHref(href: string): string {\n if (\n href.startsWith('#') ||\n href.startsWith('//') ||\n /^[a-z][a-z\\d+.-]*:/i.test(href)\n ) {\n return href\n }\n\n const match = href.match(/^([^?#]*)([?#].*)?$/)\n\n if (!match) {\n return href\n }\n\n const [, pathname, suffix = ''] = match\n\n if (!/\\.(?:md|mdx)$/i.test(pathname)) {\n return href\n }\n\n const extensionlessPathname = pathname.replace(/\\.(?:md|mdx)$/i, '')\n let normalizedPathname = extensionlessPathname\n\n if (extensionlessPathname === 'index' || extensionlessPathname === './index') {\n normalizedPathname = '.'\n } else if (extensionlessPathname.endsWith('/index')) {\n normalizedPathname = extensionlessPathname.replace(/\\/index$/, '')\n }\n\n return `${normalizedPathname}${suffix}`\n}\n\nfunction normalizeMarkdownLinks(tokens: TokensList): void {\n for (const token of tokens) {\n if (token.type === 'link' && typeof token.href === 'string') {\n token.href = normalizeMarkdownLinkHref(token.href)\n }\n\n if ('tokens' in token && Array.isArray(token.tokens)) {\n normalizeMarkdownLinks(token.tokens as TokensList)\n }\n\n if (token.type === 'list' && Array.isArray(token.items)) {\n for (const item of token.items) {\n normalizeMarkdownLinks(item.tokens as TokensList)\n }\n }\n }\n}\n\nfunction toValueFromPath(path: string): string {\n return path === '/' ? 'index' : path.replace(/^\\//, '').replace(/\\//g, '-')\n}\n\nfunction renderInline(tokens: Tokens.Generic[] | undefined): string {\n return Parser.parseInline(tokens ?? [])\n}\n\nfunction renderBlockTokens(tokens: TokensList | undefined): string {\n return Parser.parse(tokens ?? [])\n}\n\nfunction renderListItemTokens(tokens: TokensList | undefined): string {\n return Parser.parse(tokens ?? [])\n}\n\nfunction normalizeTableAlign(align: Array<string | null | undefined>): DocsTableAlign[] {\n return align.map((value) => {\n if (value === 'left' || value === 'center' || value === 'right') {\n return value\n }\n\n return null\n })\n}\n\ninterface PlaygroundPayload {\n files?: Record<string, string>\n entry?: string\n framework?: DocsPlaygroundFramework\n autorun?: boolean\n showCode?: boolean\n height?: number | string\n demoId?: string\n demoImport?: string\n}\n\ninterface PlaygroundSrcPayload {\n files: Record<string, string>\n entry: string\n framework?: DocsPlaygroundFramework\n height?: number\n renderMode?: 'sandbox' | 'component'\n}\n\nfunction parsePlaygroundSourceHeader(text: string, sourcePath: string): {\n framework?: DocsPlaygroundFramework\n height?: number\n entry: string\n renderMode: 'sandbox' | 'component'\n} {\n const lines = text\n .split('\\n')\n .map((line) => line.trim())\n .filter(Boolean)\n const metadata = new Map<string, string>()\n\n for (const line of lines) {\n const separatorIndex = line.indexOf(':')\n\n if (separatorIndex === -1) {\n throw new Error(`[docs] Invalid playground-src in ${sourcePath}: expected \"key: value\", got \"${line}\"`)\n }\n\n const key = line.slice(0, separatorIndex).trim()\n const value = line.slice(separatorIndex + 1).trim()\n\n metadata.set(key, value)\n }\n\n const frameworkRaw = metadata.get('framework')\n const framework = frameworkRaw || 'vanilla'\n const heightRaw = metadata.get('height')\n const entry = metadata.get('entry')\n const modeRaw = metadata.get('mode')\n const renderMode = modeRaw === 'component' ? 'component' : 'sandbox'\n\n if (!entry) {\n throw new Error(`[docs] Invalid playground-src in ${sourcePath}: \"entry\" is required`)\n }\n\n if (framework !== 'vanilla' && framework !== 'vue' && framework !== 'html') {\n throw new Error(`[docs] Invalid playground-src in ${sourcePath}: unsupported framework \"${framework}\"`)\n }\n\n let height: number | undefined\n\n if (heightRaw !== undefined) {\n height = Number(heightRaw)\n\n if (!Number.isFinite(height)) {\n throw new Error(`[docs] Invalid playground-src in ${sourcePath}: \"height\" must be a number`)\n }\n }\n\n return {\n framework,\n entry,\n height,\n renderMode\n }\n}\n\nfunction parsePlaygroundSourcePayload(rawSource: string, sourcePath: string): PlaygroundSrcPayload {\n const nestedTokens = marked.lexer(rawSource) as TokensList\n let metadataToken: Tokens.Paragraph | null = null\n const codeTokens: Tokens.Code[] = []\n\n for (const token of nestedTokens) {\n if (token.type === 'space') {\n continue\n }\n\n if (!metadataToken) {\n if (token.type !== 'paragraph') {\n throw new Error(`[docs] Invalid playground-src in ${sourcePath}: header metadata must be the first block`)\n }\n\n metadataToken = token as Tokens.Paragraph\n continue\n }\n\n if (token.type !== 'code') {\n throw new Error(`[docs] Invalid playground-src in ${sourcePath}: only code fences are allowed after header`)\n }\n\n codeTokens.push(token as Tokens.Code)\n }\n\n if (!metadataToken) {\n throw new Error(`[docs] Invalid playground-src in ${sourcePath}: missing header metadata`)\n }\n\n const { framework, height, entry, renderMode } = parsePlaygroundSourceHeader(metadataToken.text, sourcePath)\n const files: Record<string, string> = {}\n\n for (const codeToken of codeTokens) {\n const lang = codeToken.lang?.trim() ?? ''\n const fileMatch = lang.match(/(?:^|\\s)file=([^\\s]+)/)\n\n if (!fileMatch?.[1]) {\n throw new Error(`[docs] Invalid playground-src in ${sourcePath}: each code fence must define \"file=/path\"`)\n }\n\n const filePath = fileMatch[1]\n const content = codeToken.text.endsWith('\\n') ? codeToken.text : `${codeToken.text}\\n`\n files[filePath] = content\n }\n\n if (Object.keys(files).length === 0) {\n throw new Error(`[docs] Invalid playground-src in ${sourcePath}: at least one file fence is required`)\n }\n\n if (!files[entry]) {\n throw new Error(`[docs] Invalid playground-src in ${sourcePath}: entry \"${entry}\" is not present in files`)\n }\n\n return {\n files,\n entry,\n framework,\n height,\n renderMode\n }\n}\n\nfunction isStringRecord(value: unknown): value is Record<string, string> {\n if (!value || typeof value !== 'object' || Array.isArray(value)) {\n return false\n }\n\n return Object.values(value).every((entry) => typeof entry === 'string')\n}\n\nfunction parsePlaygroundPayload(rawSource: string): PlaygroundPayload | null {\n let parsed: unknown\n\n try {\n parsed = JSON.parse(rawSource)\n } catch {\n return null\n }\n\n if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {\n return null\n }\n\n const data = parsed as {\n files?: unknown\n entry?: unknown\n framework?: unknown\n autorun?: unknown\n showCode?: unknown\n height?: unknown\n demoId?: unknown\n demoImport?: unknown\n }\n\n const files = isStringRecord(data.files) ? data.files : undefined\n const demoId = typeof data.demoId === 'string' && data.demoId.trim()\n ? data.demoId.trim()\n : undefined\n const demoImport = typeof data.demoImport === 'string' && data.demoImport.trim()\n ? data.demoImport.trim()\n : undefined\n\n if ((!files || Object.keys(files).length === 0) && !demoId && !demoImport) {\n return null\n }\n\n return {\n files,\n entry: typeof data.entry === 'string' ? data.entry : undefined,\n framework:\n data.framework === 'vanilla' || data.framework === 'vue' || data.framework === 'html'\n ? data.framework\n : undefined,\n autorun: typeof data.autorun === 'boolean' ? data.autorun : undefined,\n showCode: typeof data.showCode === 'boolean' ? data.showCode : undefined,\n height:\n typeof data.height === 'number' || typeof data.height === 'string' ? data.height : undefined,\n demoId,\n demoImport\n }\n}\n\nfunction parsePlaygroundCodeBlock(token: Tokens.Code): DocsContentBlock | null {\n const language = token.lang?.trim().toLowerCase()\n\n if (language !== 'playground' && language !== 'vf-playground') {\n return null\n }\n\n const payload = parsePlaygroundPayload(token.text)\n\n if (!payload) {\n return null\n }\n\n if (payload.demoId || payload.demoImport) {\n return {\n type: 'playground',\n framework: payload.framework ?? 'vue',\n autorun: payload.autorun,\n showCode: payload.showCode,\n height: payload.height,\n demoId: payload.demoId,\n demoImport: payload.demoImport,\n renderMode: 'vue-module'\n }\n }\n\n if (!payload.files || Object.keys(payload.files).length === 0) {\n return null\n }\n\n const entry = payload.entry && payload.files[payload.entry]\n ? payload.entry\n : Object.keys(payload.files)[0]\n\n return {\n type: 'playground',\n files: payload.files,\n entry,\n framework: payload.framework,\n autorun: payload.autorun,\n showCode: payload.showCode,\n height: payload.height,\n renderMode: 'sandbox'\n }\n}\n\nfunction parsePlaygroundSourceCodeBlock(token: Tokens.Code, sourcePath: string): DocsContentBlock | null {\n const language = token.lang?.trim().toLowerCase()\n\n if (language !== 'playground-src' && language !== 'vf-playground-src') {\n return null\n }\n\n const payload = parsePlaygroundSourcePayload(token.text, sourcePath)\n\n return {\n type: 'playground',\n files: payload.files,\n entry: payload.entry,\n framework: payload.framework,\n height: payload.height,\n renderMode: payload.renderMode ?? 'sandbox'\n }\n}\n\nfunction renderMarkdown(markdown: string, tocLevels: Set<number>, sourcePath: string): {\n blocks: DocsContentBlock[]\n tableOfContents: VfTableOfContentsItem[]\n} {\n const tokens = marked.lexer(markdown) as TokensList\n normalizeMarkdownLinks(tokens)\n const headingSlugger = new GithubSlugger()\n const tableOfContents: VfTableOfContentsItem[] = []\n const blocks: DocsContentBlock[] = []\n\n for (const token of tokens) {\n switch (token.type) {\n case 'space':\n break\n case 'heading': {\n const id = headingSlugger.slug(token.text)\n const html = renderInline(token.tokens)\n\n blocks.push({\n type: 'heading',\n depth: token.depth as 1 | 2 | 3 | 4 | 5 | 6,\n id,\n html\n })\n\n if (tocLevels.has(token.depth)) {\n tableOfContents.push({\n id,\n label: token.text,\n level: token.depth - 1\n })\n }\n break\n }\n case 'paragraph':\n blocks.push({\n type: 'paragraph',\n html: renderInline(token.tokens)\n })\n break\n case 'code':\n {\n const playgroundSourceBlock = parsePlaygroundSourceCodeBlock(token as Tokens.Code, sourcePath)\n\n if (playgroundSourceBlock) {\n blocks.push(playgroundSourceBlock)\n break\n }\n\n const playgroundBlock = parsePlaygroundCodeBlock(token as Tokens.Code)\n\n if (playgroundBlock) {\n blocks.push(playgroundBlock)\n break\n }\n }\n blocks.push({\n type: 'code',\n code: token.text,\n language: token.lang?.trim() || 'text'\n })\n break\n case 'list':\n blocks.push({\n type: 'list',\n ordered: token.ordered,\n items: token.items.map((item: Tokens.ListItem) => renderListItemTokens(item.tokens))\n })\n break\n case 'blockquote':\n blocks.push({\n type: 'blockquote',\n html: renderBlockTokens(token.tokens)\n })\n break\n case 'table':\n blocks.push({\n type: 'table',\n header: token.header.map((cell: Tokens.TableCell) => renderInline(cell.tokens)),\n rows: token.rows.map((row: Tokens.TableCell[]) => row.map((cell) => renderInline(cell.tokens))),\n align: normalizeTableAlign(token.align)\n })\n break\n default:\n blocks.push({\n type: 'html',\n html: renderBlockTokens([token])\n })\n break\n }\n }\n\n return { blocks, tableOfContents }\n}\n\nfunction getFirstHeadingText(markdown: string): string | undefined {\n const tokens = marked.lexer(markdown) as TokensList\n const heading = tokens.find((token): token is Tokens.Heading => token.type === 'heading' && token.depth === 1)\n\n return heading?.text.trim() || undefined\n}\n\nfunction parsePage(sourcePath: string, source: string, tocLevels: Set<number>): DocsPage {\n const { data: frontmatter, content } = parseFrontmatter(source)\n const path = normalizeDocPath(sourcePath)\n const pathSegments = path === '/' ? [] : path.replace(/^\\//, '').split('/')\n const isIndexPage = isIndexSourcePath(sourcePath)\n const section = isIndexPage ? pathSegments : pathSegments.slice(0, -1)\n const filename = pathSegments[pathSegments.length - 1] ?? 'index'\n const fallbackTitle = isIndexPage ? (getFirstHeadingText(content) ?? 'Overview') : toTitleCase(filename)\n const title = frontmatter.title?.trim() || fallbackTitle\n const navTitle = frontmatter.navTitle?.trim() || (isIndexPage ? 'Overview' : title)\n const { blocks, tableOfContents } = renderMarkdown(content, tocLevels, sourcePath)\n const id = isIndexPage && path !== '/' ? `${toValueFromPath(path)}-index` : toValueFromPath(path)\n\n return {\n id,\n path,\n sourcePath,\n isIndexPage,\n title,\n navTitle,\n description: frontmatter.description?.trim(),\n order: frontmatter.order ?? 0,\n section,\n blocks,\n tableOfContents\n }\n}\n\nfunction sortNodes(nodes: NavNode[]): NavNode[] {\n return [...nodes].sort((left, right) => {\n if (left.order !== right.order) {\n return left.order - right.order\n }\n\n const leftIndexPriority = left.isIndexPage ? 0 : 1\n const rightIndexPriority = right.isIndexPage ? 0 : 1\n\n if (leftIndexPriority !== rightIndexPriority) {\n return leftIndexPriority - rightIndexPriority\n }\n\n return left.label.localeCompare(right.label)\n })\n}\n\nfunction getPageNavKey(page: DocsPage): string {\n if (page.isIndexPage) {\n return 'index'\n }\n\n return page.path.split('/').filter(Boolean).at(-1) ?? page.id\n}\n\nfunction buildSidebar(pages: DocsPage[], docsConfig: DocsConfig): VfNavMenuItem[] {\n const root = new Map<string, NavNode>()\n\n for (const page of pages) {\n let current = root\n let currentPath = ''\n\n for (const segment of page.section) {\n currentPath = `${currentPath}/${segment}`\n const sectionConfig = docsConfig.sectionLabels?.[segment]\n\n if (!current.has(segment)) {\n current.set(segment, {\n label: sectionConfig?.label ?? toTitleCase(segment),\n order: sectionConfig?.order ?? 1_000,\n value: toValueFromPath(currentPath),\n path: currentPath,\n isPage: false,\n children: new Map()\n })\n }\n\n current = current.get(segment)!.children\n }\n\n const pageKey = getPageNavKey(page)\n const existingPageNode = current.get(pageKey)\n\n current.set(pageKey, {\n label: page.navTitle,\n order: page.order,\n value: page.id,\n path: page.path,\n isPage: true,\n isIndexPage: page.isIndexPage,\n children: existingPageNode?.children ?? new Map()\n })\n }\n\n const toItems = (nodes: Map<string, NavNode>): VfNavMenuItem[] =>\n sortNodes([...nodes.values()]).map((node) => {\n const item: VfNavMenuItem = {\n value: node.value ?? toValueFromPath(node.path ?? node.label),\n label: node.label\n }\n\n const children = toItems(node.children)\n\n if (node.path && node.isPage) {\n item.to = node.path\n }\n\n if (children.length > 0) {\n if (item.to) {\n const branchValue = `${item.value}-section`\n\n item.children = [\n {\n value: item.value,\n label: 'Overview',\n to: item.to\n },\n ...children\n ]\n item.value = branchValue\n delete item.to\n } else {\n item.children = children\n }\n }\n\n return item\n })\n\n return toItems(root)\n}\n\nexport function resolveDocsContent({ docsConfig, markdownFiles }: ResolveDocsContentInput): ResolvedDocsContent {\n const tocLevels = new Set(docsConfig.toc?.levels ?? [2, 3, 4])\n\n const docsPages = Object.entries(markdownFiles)\n .map(([sourcePath, source]) => parsePage(sourcePath, source, tocLevels))\n .filter((page) => page.path !== '/')\n .sort((left, right) => left.path.localeCompare(right.path))\n\n const docsSidebar = buildSidebar(docsPages, docsConfig)\n const docsSite: DocsSiteConfig = {\n title: docsConfig.site?.title ?? docsConfig.title ?? 'docs',\n description: docsConfig.site?.description,\n githubUrl: docsConfig.site?.githubUrl,\n homeTo: docsConfig.site?.homeTo ?? '/',\n favicon: docsConfig.site?.favicon,\n logo: docsConfig.site?.logo,\n logoLabel: docsConfig.site?.logoLabel\n }\n const docsLayout: Required<DocsLayoutConfig> = {\n variant: docsConfig.layout?.variant ?? 'sidebar-content-aside',\n fillViewport: docsConfig.layout?.fillViewport ?? true,\n stickyHeader: docsConfig.layout?.stickyHeader ?? true,\n stickySidebar: docsConfig.layout?.stickySidebar ?? true,\n stickyAside: docsConfig.layout?.stickyAside ?? true,\n edgeNotches: docsConfig.layout?.edgeNotches ?? false,\n hideSidebarOnMobile: docsConfig.layout?.hideSidebarOnMobile ?? true,\n hideAsideOnMobile: docsConfig.layout?.hideAsideOnMobile ?? true\n }\n const docsFooter: DocsFooterConfig = {\n left: docsConfig.footer?.left ?? 'Codemonster documentation',\n right: docsConfig.footer?.right\n }\n const docsHome: Required<DocsHomeConfig> = {\n enabled: docsConfig.home?.enabled ?? true,\n title: docsConfig.home?.title ?? 'Build docs fast',\n description: docsConfig.home?.description ?? 'Write markdown, keep the same UI stack, and ship clean developer docs.',\n showGrid: docsConfig.home?.showGrid ?? true,\n primaryAction: docsConfig.home?.primaryAction ?? {\n label: 'Get Started',\n to: '/guide/installation'\n },\n secondaryAction: docsConfig.home?.secondaryAction ?? {\n label: 'View on GitHub',\n href: docsConfig.site?.githubUrl\n }\n }\n const docsHeaderNav: Required<DocsHeaderNavConfig> = {\n items: docsConfig.headerNav?.items ?? [],\n ariaLabel: docsConfig.headerNav?.ariaLabel ?? 'Header navigation'\n }\n const docsComponents: DocsComponentsConfig = docsConfig.components ?? {}\n const docsSiteTitle = docsSite.title\n const docsScrollOffset = docsConfig.toc?.scrollOffset ?? 96\n\n function getDocsPageByPath(pathname: string): DocsPage {\n const normalizedPath = pathname === '/' ? '/' : pathname.replace(/\\/$/, '')\n\n return docsPages.find((page) => page.path === normalizedPath) ?? docsPages[0]\n }\n\n return {\n docsPages,\n docsSidebar,\n docsSite,\n docsLayout,\n docsFooter,\n docsHome,\n docsHeaderNav,\n docsComponents,\n docsSiteTitle,\n docsScrollOffset,\n getDocsPageByPath\n }\n}\n","import type { Component } from 'vue'\nimport type { RouteRecordRaw } from 'vue-router'\nimport type { DocsPage } from './docsContent'\n\nexport interface CreateDocsRoutesInput {\n docsPages: DocsPage[]\n homeEnabled: boolean\n homeComponent: Component\n pageComponent: Component\n notFoundComponent?: Component\n}\n\nexport function createDocsRoutes({\n docsPages,\n homeEnabled,\n homeComponent,\n pageComponent,\n notFoundComponent\n}: CreateDocsRoutesInput): RouteRecordRaw[] {\n const docsPageRoutes: RouteRecordRaw[] = docsPages.map((page) => ({\n path: page.path,\n name: page.id,\n component: pageComponent\n }))\n\n const docsLandingRoute = [...docsPages].sort((left, right) => {\n if (left.order !== right.order) {\n return left.order - right.order\n }\n\n return left.path.localeCompare(right.path)\n })[0]\n\n const rootRoute: RouteRecordRaw = homeEnabled\n ? {\n path: '/',\n name: 'home',\n component: homeComponent\n }\n : docsLandingRoute\n ? {\n path: '/',\n name: 'home',\n redirect: docsLandingRoute.path\n }\n : {\n path: '/',\n name: 'home',\n component: homeComponent\n }\n\n const routes: RouteRecordRaw[] = [rootRoute, ...docsPageRoutes]\n\n if (notFoundComponent) {\n routes.push({\n path: '/:pathMatch(.*)*',\n name: 'not-found',\n component: notFoundComponent\n })\n }\n\n return routes\n}\n","import type { Component } from 'vue'\nimport type { VfNavMenuItem, VfTableOfContentsItem } from '@codemonster-ru/vueforge-core'\n\nexport interface DocsSectionConfig {\n label?: string\n order?: number\n}\n\nexport interface DocsTocConfig {\n levels?: number[]\n scrollOffset?: number\n}\n\nexport interface DocsSiteLogoConfig {\n src?: string\n component?: Component\n alt?: string\n width?: number | string\n height?: number | string\n}\n\nexport interface DocsHomeActionConfig {\n label: string\n to?: string\n href?: string\n}\n\nexport interface DocsHomeConfig {\n enabled?: boolean\n title?: string\n description?: string\n showGrid?: boolean\n primaryAction?: DocsHomeActionConfig\n secondaryAction?: DocsHomeActionConfig\n}\n\nexport interface DocsHeaderNavConfig {\n items?: VfNavMenuItem[]\n ariaLabel?: string\n}\n\nexport type DocsLayoutVariant =\n | 'content'\n | 'sidebar-content'\n | 'sidebar-content-aside'\n\nexport interface DocsSiteConfig {\n title: string\n description?: string\n githubUrl?: string\n homeTo?: string\n favicon?: string\n logo?: DocsSiteLogoConfig\n logoLabel?: string\n}\n\nexport interface DocsLayoutConfig {\n variant?: DocsLayoutVariant\n fillViewport?: boolean\n stickyHeader?: boolean\n stickySidebar?: boolean\n stickyAside?: boolean\n edgeNotches?: boolean\n hideSidebarOnMobile?: boolean\n hideAsideOnMobile?: boolean\n}\n\nexport interface DocsFooterConfig {\n left?: string\n right?: string\n}\n\nexport interface DocsPageMeta {\n title: string\n path: string\n}\n\nexport interface DocsHeaderProps {\n site: DocsSiteConfig\n}\n\nexport interface DocsBrandProps {\n site: DocsSiteConfig\n}\n\nexport interface DocsFooterProps {\n site: DocsSiteConfig\n}\n\nexport interface DocsHeaderNavProps {\n site: DocsSiteConfig\n items: VfNavMenuItem[]\n activeValue?: string\n}\n\nexport interface DocsSidebarProps {\n site: DocsSiteConfig\n page: DocsPageMeta\n items: VfNavMenuItem[]\n}\n\nexport interface DocsAsideProps {\n site: DocsSiteConfig\n page: DocsPageMeta\n items: VfTableOfContentsItem[]\n}\n\nexport interface DocsLayoutProps {\n site: DocsSiteConfig\n page: DocsPageMeta\n layout: Required<DocsLayoutConfig>\n sidebarItems: VfNavMenuItem[]\n tocItems: VfTableOfContentsItem[]\n}\n\nexport interface DocsComponentsConfig {\n Brand?: Component\n Home?: Component\n Header?: Component\n HeaderNav?: Component\n Footer?: Component\n SidebarTop?: Component\n SidebarBottom?: Component\n AsideTop?: Component\n AsideBottom?: Component\n Layout?: Component\n}\n\nexport interface DocsConfig {\n title?: string\n site?: Partial<DocsSiteConfig>\n home?: DocsHomeConfig\n headerNav?: DocsHeaderNavConfig\n layout?: DocsLayoutConfig\n footer?: DocsFooterConfig\n components?: DocsComponentsConfig\n sectionLabels?: Record<string, DocsSectionConfig>\n toc?: DocsTocConfig\n}\n\nexport function defineDocsConfig(config: DocsConfig): DocsConfig {\n return config\n}\n"],"mappings":";AAAA,SAAS,cAAc,wBAAwB;AAC/C,SAAS,cAAc,wBAAwB;AAC/C,SAAS,WAAW,oBAAoC;AACxD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AAsBP,eAAe,gBAA+B;AAC5C,MAAI,OAAO,aAAa,eAA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EACF;AACF;;;AC/yBO,SAAS,iBAAiB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA4C;AAC1C,QAAM,iBAAmC,UAAU,IAAI,CAAC,UAAU;AAAA,IAChE,MAAM,KAAK;AAAA,IACX,MAAM,KAAK;AAAA,IACX,WAAW;AAAA,EACb,EAAE;AAEF,QAAM,mBAAmB,CAAC,GAAG,SAAS,EAAE,KAAK,CAAC,MAAM,UAAU;AAC5D,QAAI,KAAK,UAAU,MAAM,OAAO;AAC9B,aAAO,KAAK,QAAQ,MAAM;AAAA,IAC5B;AAEA,WAAO,KAAK,KAAK,cAAc,MAAM,IAAI;AAAA,EAC3C,CAAC,EAAE,CAAC;AAEJ,QAAM,YAA4B,cAC9B;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,WAAW;AAAA,EACb,IACA,mBACE;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,UAAU,iBAAiB;AAAA,EAC7B,IACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,WAAW;AAAA,EACb;AAEN,QAAM,SAA2B,CAAC,WAAW,GAAG,cAAc;AAE9D,MAAI,mBAAmB;AACrB,WAAO,KAAK;AAAA,MACV,MAAM;AAAA,MACN,MAAM;AAAA,MACN,WAAW;AAAA,IACb,CAAC;AAAA,EACH;AAEA,SAAO;AACT;;;AC8EO,SAAS,iBAAiB,QAAgC;AAC/D,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
interface MarkdownComponentPlayground {
|
|
2
|
+
entry: string;
|
|
3
|
+
files: Record<string, string>;
|
|
4
|
+
id: string;
|
|
5
|
+
source: string;
|
|
6
|
+
}
|
|
7
|
+
interface MarkdownComponentPlaygroundOptions {
|
|
8
|
+
contentRoot: string;
|
|
9
|
+
generatedRegistryPath: string;
|
|
10
|
+
virtualPrefix?: string;
|
|
11
|
+
}
|
|
12
|
+
interface MarkdownComponentPlaygroundRegistryOptions {
|
|
13
|
+
generatedRegistryPath: string;
|
|
14
|
+
virtualPrefix?: string;
|
|
15
|
+
}
|
|
16
|
+
declare const DEFAULT_MARKDOWN_COMPONENT_PLAYGROUND_PREFIX = "virtual:docs-markdown-playground/";
|
|
17
|
+
declare function walkMarkdownFiles(rootDir: string): string[];
|
|
18
|
+
declare function hashPlaygroundSource(source: string): string;
|
|
19
|
+
declare function parsePlaygroundSourceOptions(source: string): Record<string, string>;
|
|
20
|
+
declare function parsePlaygroundSourceFiles(source: string): Record<string, string>;
|
|
21
|
+
declare function collectMarkdownComponentPlaygrounds(contentRoot: string): MarkdownComponentPlayground[];
|
|
22
|
+
declare function writeMarkdownComponentPlaygroundRegistry(demos: MarkdownComponentPlayground[], options: MarkdownComponentPlaygroundRegistryOptions): void;
|
|
23
|
+
declare function createMarkdownComponentPlaygroundPlugin(demos: MarkdownComponentPlayground[], virtualPrefix?: string): {
|
|
24
|
+
name: string;
|
|
25
|
+
resolveId(id: string): string | null;
|
|
26
|
+
load(id: string): string | null;
|
|
27
|
+
};
|
|
28
|
+
declare function createMarkdownComponentPlaygrounds(options: MarkdownComponentPlaygroundOptions): {
|
|
29
|
+
demos: MarkdownComponentPlayground[];
|
|
30
|
+
plugin: {
|
|
31
|
+
name: string;
|
|
32
|
+
resolveId(id: string): string | null;
|
|
33
|
+
load(id: string): string | null;
|
|
34
|
+
};
|
|
35
|
+
virtualPrefix: string;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export { DEFAULT_MARKDOWN_COMPONENT_PLAYGROUND_PREFIX, type MarkdownComponentPlayground, type MarkdownComponentPlaygroundOptions, type MarkdownComponentPlaygroundRegistryOptions, collectMarkdownComponentPlaygrounds, createMarkdownComponentPlaygroundPlugin, createMarkdownComponentPlaygrounds, hashPlaygroundSource, parsePlaygroundSourceFiles, parsePlaygroundSourceOptions, walkMarkdownFiles, writeMarkdownComponentPlaygroundRegistry };
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
// src/playground.ts
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import { dirname, extname, join, relative } from "path";
|
|
4
|
+
var DEFAULT_MARKDOWN_COMPONENT_PLAYGROUND_PREFIX = "virtual:docs-markdown-playground/";
|
|
5
|
+
function walkMarkdownFiles(rootDir) {
|
|
6
|
+
if (!fs.existsSync(rootDir)) {
|
|
7
|
+
return [];
|
|
8
|
+
}
|
|
9
|
+
const files = [];
|
|
10
|
+
const stack = [rootDir];
|
|
11
|
+
while (stack.length > 0) {
|
|
12
|
+
const current = stack.pop();
|
|
13
|
+
for (const entry of fs.readdirSync(current)) {
|
|
14
|
+
const fullPath = join(current, entry);
|
|
15
|
+
const info = fs.statSync(fullPath);
|
|
16
|
+
if (info.isDirectory()) {
|
|
17
|
+
stack.push(fullPath);
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
if (extname(fullPath) === ".md") {
|
|
21
|
+
files.push(fullPath);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return files;
|
|
26
|
+
}
|
|
27
|
+
function hashPlaygroundSource(source) {
|
|
28
|
+
let hash = 2166136261;
|
|
29
|
+
for (let index = 0; index < source.length; index += 1) {
|
|
30
|
+
hash ^= source.charCodeAt(index);
|
|
31
|
+
hash = Math.imul(hash, 16777619);
|
|
32
|
+
}
|
|
33
|
+
return (hash >>> 0).toString(36);
|
|
34
|
+
}
|
|
35
|
+
function parsePlaygroundSourceOptions(source) {
|
|
36
|
+
const options = {};
|
|
37
|
+
const firstFileFenceIndex = source.search(/^```/m);
|
|
38
|
+
const header = firstFileFenceIndex >= 0 ? source.slice(0, firstFileFenceIndex) : source;
|
|
39
|
+
for (const line of header.split("\n")) {
|
|
40
|
+
const match = line.match(/^([a-zA-Z0-9_-]+):\s*(.+)$/);
|
|
41
|
+
if (match?.[1] && match[2]) {
|
|
42
|
+
options[match[1]] = match[2].trim();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return options;
|
|
46
|
+
}
|
|
47
|
+
function parsePlaygroundSourceFiles(source) {
|
|
48
|
+
const files = {};
|
|
49
|
+
const fileFenceRe = /^```([a-zA-Z0-9_-]+)\s+file=(\S+)\s*\n([\s\S]*?)\n```/gm;
|
|
50
|
+
let match;
|
|
51
|
+
while ((match = fileFenceRe.exec(source)) !== null) {
|
|
52
|
+
if (match[2] && typeof match[3] === "string") {
|
|
53
|
+
files[match[2]] = match[3];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return files;
|
|
57
|
+
}
|
|
58
|
+
function collectMarkdownComponentPlaygrounds(contentRoot) {
|
|
59
|
+
const demos = /* @__PURE__ */ new Map();
|
|
60
|
+
const playgroundBlockRe = /^````playground-src\s*\n([\s\S]*?)\n````/gm;
|
|
61
|
+
for (const filePath of walkMarkdownFiles(contentRoot)) {
|
|
62
|
+
const markdown = fs.readFileSync(filePath, "utf8");
|
|
63
|
+
let match;
|
|
64
|
+
while ((match = playgroundBlockRe.exec(markdown)) !== null) {
|
|
65
|
+
const blockSource = match[1];
|
|
66
|
+
if (!blockSource) {
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
const options = parsePlaygroundSourceOptions(blockSource);
|
|
70
|
+
const entry = options.entry;
|
|
71
|
+
if (options.mode !== "component" || !entry?.endsWith(".vue")) {
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
const files = parsePlaygroundSourceFiles(blockSource);
|
|
75
|
+
const source = files[entry];
|
|
76
|
+
if (typeof source !== "string") {
|
|
77
|
+
throw new Error(
|
|
78
|
+
`[docs] Markdown component playground in ${relative(process.cwd(), filePath)} uses entry "${entry}", but that file was not found in the playground block.`
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
const id = hashPlaygroundSource(source);
|
|
82
|
+
demos.set(id, {
|
|
83
|
+
entry,
|
|
84
|
+
files,
|
|
85
|
+
id,
|
|
86
|
+
source
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return [...demos.values()].sort((left, right) => left.id.localeCompare(right.id));
|
|
91
|
+
}
|
|
92
|
+
function toMarkdownImportVarName(demoId) {
|
|
93
|
+
return `MarkdownPlayground${demoId.replace(/[^a-zA-Z0-9_$]/g, "_")}Demo`;
|
|
94
|
+
}
|
|
95
|
+
function writeMarkdownComponentPlaygroundRegistry(demos, options) {
|
|
96
|
+
const virtualPrefix = options.virtualPrefix ?? DEFAULT_MARKDOWN_COMPONENT_PLAYGROUND_PREFIX;
|
|
97
|
+
const lines = [];
|
|
98
|
+
lines.push("// This file is auto-generated by vue-ssg markdown playground scanner. Do not edit manually.");
|
|
99
|
+
lines.push("import type { Component } from 'vue'");
|
|
100
|
+
lines.push("");
|
|
101
|
+
for (const demo of demos) {
|
|
102
|
+
lines.push(`import ${toMarkdownImportVarName(demo.id)} from '${virtualPrefix}${demo.id}.vue'`);
|
|
103
|
+
}
|
|
104
|
+
lines.push("");
|
|
105
|
+
lines.push("export const docsVirtualPlaygroundRegistry: Record<string, Component> = {");
|
|
106
|
+
for (const demo of demos) {
|
|
107
|
+
lines.push(` '${demo.id}': ${toMarkdownImportVarName(demo.id)},`);
|
|
108
|
+
}
|
|
109
|
+
lines.push("}");
|
|
110
|
+
lines.push("");
|
|
111
|
+
lines.push("export const docsVirtualPlaygroundSourceRegistry: Record<string, string> = {");
|
|
112
|
+
for (const demo of demos) {
|
|
113
|
+
lines.push(` '${demo.id}': ${JSON.stringify(demo.source)},`);
|
|
114
|
+
}
|
|
115
|
+
lines.push("}");
|
|
116
|
+
lines.push("");
|
|
117
|
+
lines.push("export const docsVirtualPlaygroundSourceFileRegistry: Record<string, string> = {");
|
|
118
|
+
for (const demo of demos) {
|
|
119
|
+
lines.push(` '${demo.id}': ${JSON.stringify(demo.entry)},`);
|
|
120
|
+
}
|
|
121
|
+
lines.push("}");
|
|
122
|
+
lines.push("");
|
|
123
|
+
lines.push("export const docsVirtualPlaygroundSourceLanguageRegistry: Record<string, string> = {");
|
|
124
|
+
for (const demo of demos) {
|
|
125
|
+
lines.push(` '${demo.id}': 'vue',`);
|
|
126
|
+
}
|
|
127
|
+
lines.push("}");
|
|
128
|
+
lines.push("");
|
|
129
|
+
fs.mkdirSync(dirname(options.generatedRegistryPath), { recursive: true });
|
|
130
|
+
fs.writeFileSync(options.generatedRegistryPath, lines.join("\n"), "utf8");
|
|
131
|
+
}
|
|
132
|
+
function createMarkdownComponentPlaygroundPlugin(demos, virtualPrefix = DEFAULT_MARKDOWN_COMPONENT_PLAYGROUND_PREFIX) {
|
|
133
|
+
const sourceById = new Map(demos.map((demo) => [demo.id, demo.source]));
|
|
134
|
+
return {
|
|
135
|
+
name: "vue-ssg-markdown-component-playgrounds",
|
|
136
|
+
resolveId(id) {
|
|
137
|
+
if (id.startsWith(virtualPrefix)) {
|
|
138
|
+
return id;
|
|
139
|
+
}
|
|
140
|
+
return null;
|
|
141
|
+
},
|
|
142
|
+
load(id) {
|
|
143
|
+
if (!id.startsWith(virtualPrefix)) {
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
const demoId = id.slice(virtualPrefix.length).replace(/\.vue$/, "");
|
|
147
|
+
return sourceById.get(demoId) ?? null;
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
function createMarkdownComponentPlaygrounds(options) {
|
|
152
|
+
const virtualPrefix = options.virtualPrefix ?? DEFAULT_MARKDOWN_COMPONENT_PLAYGROUND_PREFIX;
|
|
153
|
+
const demos = collectMarkdownComponentPlaygrounds(options.contentRoot);
|
|
154
|
+
writeMarkdownComponentPlaygroundRegistry(demos, {
|
|
155
|
+
generatedRegistryPath: options.generatedRegistryPath,
|
|
156
|
+
virtualPrefix
|
|
157
|
+
});
|
|
158
|
+
return {
|
|
159
|
+
demos,
|
|
160
|
+
plugin: createMarkdownComponentPlaygroundPlugin(demos, virtualPrefix),
|
|
161
|
+
virtualPrefix
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
export {
|
|
165
|
+
DEFAULT_MARKDOWN_COMPONENT_PLAYGROUND_PREFIX,
|
|
166
|
+
collectMarkdownComponentPlaygrounds,
|
|
167
|
+
createMarkdownComponentPlaygroundPlugin,
|
|
168
|
+
createMarkdownComponentPlaygrounds,
|
|
169
|
+
hashPlaygroundSource,
|
|
170
|
+
parsePlaygroundSourceFiles,
|
|
171
|
+
parsePlaygroundSourceOptions,
|
|
172
|
+
walkMarkdownFiles,
|
|
173
|
+
writeMarkdownComponentPlaygroundRegistry
|
|
174
|
+
};
|
|
175
|
+
//# sourceMappingURL=playground.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/playground.ts"],"sourcesContent":["import fs from 'node:fs'\nimport { dirname, extname, join, relative } from 'node:path'\n\nexport interface MarkdownComponentPlayground {\n entry: string\n files: Record<string, string>\n id: string\n source: string\n}\n\nexport interface MarkdownComponentPlaygroundOptions {\n contentRoot: string\n generatedRegistryPath: string\n virtualPrefix?: string\n}\n\nexport interface MarkdownComponentPlaygroundRegistryOptions {\n generatedRegistryPath: string\n virtualPrefix?: string\n}\n\nexport const DEFAULT_MARKDOWN_COMPONENT_PLAYGROUND_PREFIX = 'virtual:docs-markdown-playground/'\n\nexport function walkMarkdownFiles(rootDir: string): string[] {\n if (!fs.existsSync(rootDir)) {\n return []\n }\n\n const files: string[] = []\n const stack = [rootDir]\n\n while (stack.length > 0) {\n const current = stack.pop()!\n for (const entry of fs.readdirSync(current)) {\n const fullPath = join(current, entry)\n const info = fs.statSync(fullPath)\n if (info.isDirectory()) {\n stack.push(fullPath)\n continue\n }\n\n if (extname(fullPath) === '.md') {\n files.push(fullPath)\n }\n }\n }\n\n return files\n}\n\nexport function hashPlaygroundSource(source: string): string {\n let hash = 2166136261\n for (let index = 0; index < source.length; index += 1) {\n hash ^= source.charCodeAt(index)\n hash = Math.imul(hash, 16777619)\n }\n\n return (hash >>> 0).toString(36)\n}\n\nexport function parsePlaygroundSourceOptions(source: string): Record<string, string> {\n const options: Record<string, string> = {}\n const firstFileFenceIndex = source.search(/^```/m)\n const header = firstFileFenceIndex >= 0 ? source.slice(0, firstFileFenceIndex) : source\n\n for (const line of header.split('\\n')) {\n const match = line.match(/^([a-zA-Z0-9_-]+):\\s*(.+)$/)\n if (match?.[1] && match[2]) {\n options[match[1]] = match[2].trim()\n }\n }\n\n return options\n}\n\nexport function parsePlaygroundSourceFiles(source: string): Record<string, string> {\n const files: Record<string, string> = {}\n const fileFenceRe = /^```([a-zA-Z0-9_-]+)\\s+file=(\\S+)\\s*\\n([\\s\\S]*?)\\n```/gm\n let match: RegExpExecArray | null\n\n while ((match = fileFenceRe.exec(source)) !== null) {\n if (match[2] && typeof match[3] === 'string') {\n files[match[2]] = match[3]\n }\n }\n\n return files\n}\n\nexport function collectMarkdownComponentPlaygrounds(contentRoot: string): MarkdownComponentPlayground[] {\n const demos = new Map<string, MarkdownComponentPlayground>()\n const playgroundBlockRe = /^````playground-src\\s*\\n([\\s\\S]*?)\\n````/gm\n\n for (const filePath of walkMarkdownFiles(contentRoot)) {\n const markdown = fs.readFileSync(filePath, 'utf8')\n let match: RegExpExecArray | null\n\n while ((match = playgroundBlockRe.exec(markdown)) !== null) {\n const blockSource = match[1]\n if (!blockSource) {\n continue\n }\n\n const options = parsePlaygroundSourceOptions(blockSource)\n const entry = options.entry\n if (options.mode !== 'component' || !entry?.endsWith('.vue')) {\n continue\n }\n\n const files = parsePlaygroundSourceFiles(blockSource)\n const source = files[entry]\n if (typeof source !== 'string') {\n throw new Error(\n `[docs] Markdown component playground in ${relative(process.cwd(), filePath)} uses entry \"${entry}\", but that file was not found in the playground block.`\n )\n }\n\n const id = hashPlaygroundSource(source)\n demos.set(id, {\n entry,\n files,\n id,\n source\n })\n }\n }\n\n return [...demos.values()].sort((left, right) => left.id.localeCompare(right.id))\n}\n\nfunction toMarkdownImportVarName(demoId: string): string {\n return `MarkdownPlayground${demoId.replace(/[^a-zA-Z0-9_$]/g, '_')}Demo`\n}\n\nexport function writeMarkdownComponentPlaygroundRegistry(\n demos: MarkdownComponentPlayground[],\n options: MarkdownComponentPlaygroundRegistryOptions\n): void {\n const virtualPrefix = options.virtualPrefix ?? DEFAULT_MARKDOWN_COMPONENT_PLAYGROUND_PREFIX\n const lines: string[] = []\n lines.push('// This file is auto-generated by vue-ssg markdown playground scanner. Do not edit manually.')\n lines.push(\"import type { Component } from 'vue'\")\n lines.push('')\n\n for (const demo of demos) {\n lines.push(`import ${toMarkdownImportVarName(demo.id)} from '${virtualPrefix}${demo.id}.vue'`)\n }\n\n lines.push('')\n lines.push('export const docsVirtualPlaygroundRegistry: Record<string, Component> = {')\n for (const demo of demos) {\n lines.push(` '${demo.id}': ${toMarkdownImportVarName(demo.id)},`)\n }\n lines.push('}')\n lines.push('')\n lines.push('export const docsVirtualPlaygroundSourceRegistry: Record<string, string> = {')\n for (const demo of demos) {\n lines.push(` '${demo.id}': ${JSON.stringify(demo.source)},`)\n }\n lines.push('}')\n lines.push('')\n lines.push(\"export const docsVirtualPlaygroundSourceFileRegistry: Record<string, string> = {\")\n for (const demo of demos) {\n lines.push(` '${demo.id}': ${JSON.stringify(demo.entry)},`)\n }\n lines.push('}')\n lines.push('')\n lines.push(\"export const docsVirtualPlaygroundSourceLanguageRegistry: Record<string, string> = {\")\n for (const demo of demos) {\n lines.push(` '${demo.id}': 'vue',`)\n }\n lines.push('}')\n lines.push('')\n\n fs.mkdirSync(dirname(options.generatedRegistryPath), { recursive: true })\n fs.writeFileSync(options.generatedRegistryPath, lines.join('\\n'), 'utf8')\n}\n\nexport function createMarkdownComponentPlaygroundPlugin(\n demos: MarkdownComponentPlayground[],\n virtualPrefix = DEFAULT_MARKDOWN_COMPONENT_PLAYGROUND_PREFIX\n) {\n const sourceById = new Map(demos.map((demo) => [demo.id, demo.source]))\n\n return {\n name: 'vue-ssg-markdown-component-playgrounds',\n resolveId(id: string) {\n if (id.startsWith(virtualPrefix)) {\n return id\n }\n\n return null\n },\n load(id: string) {\n if (!id.startsWith(virtualPrefix)) {\n return null\n }\n\n const demoId = id\n .slice(virtualPrefix.length)\n .replace(/\\.vue$/, '')\n\n return sourceById.get(demoId) ?? null\n }\n }\n}\n\nexport function createMarkdownComponentPlaygrounds(options: MarkdownComponentPlaygroundOptions) {\n const virtualPrefix = options.virtualPrefix ?? DEFAULT_MARKDOWN_COMPONENT_PLAYGROUND_PREFIX\n const demos = collectMarkdownComponentPlaygrounds(options.contentRoot)\n\n writeMarkdownComponentPlaygroundRegistry(demos, {\n generatedRegistryPath: options.generatedRegistryPath,\n virtualPrefix\n })\n\n return {\n demos,\n plugin: createMarkdownComponentPlaygroundPlugin(demos, virtualPrefix),\n virtualPrefix\n }\n}\n"],"mappings":";AAAA,OAAO,QAAQ;AACf,SAAS,SAAS,SAAS,MAAM,gBAAgB;AAoB1C,IAAM,+CAA+C;AAErD,SAAS,kBAAkB,SAA2B;AAC3D,MAAI,CAAC,GAAG,WAAW,OAAO,GAAG;AAC3B,WAAO,CAAC;AAAA,EACV;AAEA,QAAM,QAAkB,CAAC;AACzB,QAAM,QAAQ,CAAC,OAAO;AAEtB,SAAO,MAAM,SAAS,GAAG;AACvB,UAAM,UAAU,MAAM,IAAI;AAC1B,eAAW,SAAS,GAAG,YAAY,OAAO,GAAG;AAC3C,YAAM,WAAW,KAAK,SAAS,KAAK;AACpC,YAAM,OAAO,GAAG,SAAS,QAAQ;AACjC,UAAI,KAAK,YAAY,GAAG;AACtB,cAAM,KAAK,QAAQ;AACnB;AAAA,MACF;AAEA,UAAI,QAAQ,QAAQ,MAAM,OAAO;AAC/B,cAAM,KAAK,QAAQ;AAAA,MACrB;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;AAEO,SAAS,qBAAqB,QAAwB;AAC3D,MAAI,OAAO;AACX,WAAS,QAAQ,GAAG,QAAQ,OAAO,QAAQ,SAAS,GAAG;AACrD,YAAQ,OAAO,WAAW,KAAK;AAC/B,WAAO,KAAK,KAAK,MAAM,QAAQ;AAAA,EACjC;AAEA,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1
|
{
|
|
2
2
|
"name": "@codemonster-ru/vue-ssg-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Core APIs for Codemonster SSG apps.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vue",
|
|
@@ -31,6 +31,10 @@
|
|
|
31
31
|
".": {
|
|
32
32
|
"types": "./dist/index.d.ts",
|
|
33
33
|
"import": "./dist/index.js"
|
|
34
|
+
},
|
|
35
|
+
"./playground": {
|
|
36
|
+
"types": "./dist/playground.d.ts",
|
|
37
|
+
"import": "./dist/playground.js"
|
|
34
38
|
}
|
|
35
39
|
},
|
|
36
40
|
"files": [
|
|
@@ -45,12 +49,12 @@
|
|
|
45
49
|
"prepublishOnly": "npm run typecheck && npm run build"
|
|
46
50
|
},
|
|
47
51
|
"peerDependencies": {
|
|
52
|
+
"@unhead/vue": "^2.0.0",
|
|
48
53
|
"vue": "^3.5.0",
|
|
49
|
-
"vue-router": "^4.0.0 || ^5.0.0"
|
|
50
|
-
"@unhead/vue": "^2.0.0"
|
|
54
|
+
"vue-router": "^4.0.0 || ^5.0.0"
|
|
51
55
|
},
|
|
52
56
|
"dependencies": {
|
|
53
|
-
"@codemonster-ru/vueforge-core": "^1.
|
|
57
|
+
"@codemonster-ru/vueforge-core": "^1.18.2",
|
|
54
58
|
"github-slugger": "^2.0.0",
|
|
55
59
|
"marked": "^17.0.5"
|
|
56
60
|
},
|