semajsx 0.1.1 → 0.1.2
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/{computed-BpjqvQu1.mjs → computed-BidG06Lt.mjs} +2 -2
- package/dist/{computed-BpjqvQu1.mjs.map → computed-BidG06Lt.mjs.map} +1 -1
- package/dist/{document-OGuk9jhK.mjs → document-BOJDaiBc.mjs} +19 -4
- package/dist/document-BOJDaiBc.mjs.map +1 -0
- package/dist/{document-DFsOtfef.mjs → document-CwHVG_PJ.mjs} +2 -2
- package/dist/dom/index.d.mts +68 -3
- package/dist/dom/index.d.mts.map +1 -1
- package/dist/dom/index.mjs +4 -4
- package/dist/dom/jsx-dev-runtime.d.mts +4 -4
- package/dist/dom/jsx-dev-runtime.mjs +1 -1
- package/dist/dom/jsx-runtime.d.mts +4 -4
- package/dist/dom/jsx-runtime.mjs +2 -2
- package/dist/{helpers-DrifjCXb.d.mts → helpers-CfRDJgcP.d.mts} +3 -3
- package/dist/{helpers-DrifjCXb.d.mts.map → helpers-CfRDJgcP.d.mts.map} +1 -1
- package/dist/{index-DS5X3Pvb.d.mts → index-B1pjI-Su.d.mts} +2 -2
- package/dist/{index-DS5X3Pvb.d.mts.map → index-B1pjI-Su.d.mts.map} +1 -1
- package/dist/index-DC3tthWf.d.mts +81 -0
- package/dist/index-DC3tthWf.d.mts.map +1 -0
- package/dist/index.d.mts +7 -7
- package/dist/index.mjs +5 -5
- package/dist/{island-marker-hZdmHMvx.d.mts → island-marker-BJIO07Vj.d.mts} +1 -1
- package/dist/island-marker-BJIO07Vj.d.mts.map +1 -0
- package/dist/{jsx-CGW4OyqA.d.mts → jsx-fNlLjLou.d.mts} +2 -2
- package/dist/{jsx-CGW4OyqA.d.mts.map → jsx-fNlLjLou.d.mts.map} +1 -1
- package/dist/{jsx-runtime-DU8DRISG.d.mts → jsx-runtime-BFuFPDzn.d.mts} +3 -3
- package/dist/{jsx-runtime-DU8DRISG.d.mts.map → jsx-runtime-BFuFPDzn.d.mts.map} +1 -1
- package/dist/jsx-runtime-D9ZNjMJ2.mjs.map +1 -1
- package/dist/{jsx-runtime-mBpL8czJ.d.mts → jsx-runtime-DZx2Yv-t.d.mts} +28 -6
- package/dist/{jsx-runtime-mBpL8czJ.d.mts.map → jsx-runtime-DZx2Yv-t.d.mts.map} +1 -1
- package/dist/lucide-CVtHepGM.mjs +126 -0
- package/dist/lucide-CVtHepGM.mjs.map +1 -0
- package/dist/{resource-B1IudM8_.d.mts → resource-BQI6AeJ0.d.mts} +23 -3
- package/dist/resource-BQI6AeJ0.d.mts.map +1 -0
- package/dist/{resource-BjsDAkbG.mjs → resource-DSlXDZZi.mjs} +2 -2
- package/dist/{resource-BjsDAkbG.mjs.map → resource-DSlXDZZi.mjs.map} +1 -1
- package/dist/signal/index.d.mts +2 -2
- package/dist/signal/index.mjs +3 -3
- package/dist/{signal-4PgGfydw.mjs → signal-BN8vHXDb.mjs} +1 -1
- package/dist/{signal-4PgGfydw.mjs.map → signal-BN8vHXDb.mjs.map} +1 -1
- package/dist/{signal-CLsaPA7c.d.mts → signal-BwxUlXKs.d.mts} +1 -1
- package/dist/{signal-CLsaPA7c.d.mts.map → signal-BwxUlXKs.d.mts.map} +1 -1
- package/dist/{src-CRi0xsNK.mjs → src-BqX3sryB.mjs} +68 -5
- package/dist/src-BqX3sryB.mjs.map +1 -0
- package/dist/src-DR-EWgVP.mjs +868 -0
- package/dist/src-DR-EWgVP.mjs.map +1 -0
- package/dist/{src-DEoBG1zB.mjs → src-DUpFNNM_.mjs} +4 -4
- package/dist/{src-DEoBG1zB.mjs.map → src-DUpFNNM_.mjs.map} +1 -1
- package/dist/{src-BlS3Hc-L.mjs → src-DW3tIczg.mjs} +75 -5
- package/dist/src-DW3tIczg.mjs.map +1 -0
- package/dist/{src-Jbt_w0hc.mjs → src-Ds9vl42d.mjs} +37 -35
- package/dist/src-Ds9vl42d.mjs.map +1 -0
- package/dist/{src-iC-NFwTy.mjs → src-DuSN6go_.mjs} +79 -22
- package/dist/src-DuSN6go_.mjs.map +1 -0
- package/dist/ssg/index.d.mts +4 -182
- package/dist/ssg/index.d.mts.map +1 -1
- package/dist/ssg/index.mjs +7 -756
- package/dist/ssg/index.mjs.map +1 -1
- package/dist/ssg/plugins/docs-theme.d.mts +180 -0
- package/dist/ssg/plugins/docs-theme.d.mts.map +1 -0
- package/dist/ssg/plugins/docs-theme.mjs +2042 -0
- package/dist/ssg/plugins/docs-theme.mjs.map +1 -0
- package/dist/ssg/plugins/lucide.d.mts +3 -0
- package/dist/ssg/plugins/lucide.mjs +7 -0
- package/dist/ssr/client.d.mts +3 -3
- package/dist/ssr/client.mjs +5 -5
- package/dist/ssr/index.d.mts +3 -3
- package/dist/ssr/index.d.mts.map +1 -1
- package/dist/ssr/index.mjs +6 -5
- package/dist/style/index.d.mts +2 -2
- package/dist/style/index.d.mts.map +1 -1
- package/dist/style/index.mjs +1 -1
- package/dist/style/react.d.mts +2 -2
- package/dist/style/react.mjs +2 -2
- package/dist/style/vue.d.mts +2 -2
- package/dist/style/vue.mjs +2 -2
- package/dist/terminal/index.d.mts +4 -4
- package/dist/terminal/index.mjs +2 -2
- package/dist/terminal/jsx-dev-runtime.d.mts +4 -4
- package/dist/terminal/jsx-dev-runtime.mjs +1 -1
- package/dist/terminal/jsx-runtime.d.mts +4 -4
- package/dist/terminal/jsx-runtime.mjs +1 -1
- package/dist/{types-DlNR9ZaJ.d.mts → types-BlaUrkq0.d.mts} +2 -2
- package/dist/{types-DlNR9ZaJ.d.mts.map → types-BlaUrkq0.d.mts.map} +1 -1
- package/dist/types-CGkRxnQB.d.mts +220 -0
- package/dist/types-CGkRxnQB.d.mts.map +1 -0
- package/dist/{types-Dgj6n-EE.d.mts → types-CZMcXQTW.d.mts} +9 -4
- package/dist/types-CZMcXQTW.d.mts.map +1 -0
- package/dist/{types-Bjx1Pp14.d.mts → types-D0jRO840.d.mts} +1 -1
- package/dist/{types-Bjx1Pp14.d.mts.map → types-D0jRO840.d.mts.map} +1 -1
- package/dist/{types-DEi0apQO.d.mts → types-DucvOZQ2.d.mts} +2 -2
- package/dist/{types-DEi0apQO.d.mts.map → types-DucvOZQ2.d.mts.map} +1 -1
- package/dist/{utils-BrGmTgfG.mjs → utils-DbTAs943.mjs} +1 -1
- package/dist/{utils-BrGmTgfG.mjs.map → utils-DbTAs943.mjs.map} +1 -1
- package/package.json +30 -2
- package/dist/document-OGuk9jhK.mjs.map +0 -1
- package/dist/island-marker-hZdmHMvx.d.mts.map +0 -1
- package/dist/jsx-runtime-D2B2BK8X.mjs +0 -4
- package/dist/resource-B1IudM8_.d.mts.map +0 -1
- package/dist/src-BlS3Hc-L.mjs.map +0 -1
- package/dist/src-CRi0xsNK.mjs.map +0 -1
- package/dist/src-Jbt_w0hc.mjs.map +0 -1
- package/dist/src-iC-NFwTy.mjs.map +0 -1
- package/dist/types-Dgj6n-EE.d.mts.map +0 -1
package/dist/ssg/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["fsWatch"],"sources":["../../../ssg/src/document.tsx","../../../ssg/src/types.ts","../../../ssg/src/mdx/processor.ts","../../../ssg/src/mdx/vite-plugin.ts","../../../ssg/src/ssg.ts","../../../ssg/src/collection/index.ts","../../../ssg/src/sources/base.ts","../../../ssg/src/sources/file.ts","../../../ssg/src/sources/git.ts","../../../ssg/src/sources/remote.ts","../../../ssg/src/sources/custom.ts","../../../ssg/src/watcher/webhook.ts"],"sourcesContent":["/** @jsxImportSource @semajsx/dom */\n\nimport type { DocumentTemplate } from \"./types\";\n\n/**\n * Default HTML document template for SSG\n */\nexport const DefaultDocument: DocumentTemplate = ({\n children,\n title = \"SSG Page\",\n scripts,\n css,\n}) => (\n <html lang=\"en\">\n <head>\n <meta charSet=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <title>{title}</title>\n {css?.map((href) => (\n <link rel=\"stylesheet\" href={href} />\n ))}\n </head>\n <body>\n {children}\n {scripts}\n </body>\n </html>\n);\n","import type { Component, VNode } from \"@semajsx/core\";\nimport type { z } from \"zod\";\n\n// =============================================================================\n// Collection Registry (for type inference)\n// =============================================================================\n\n/**\n * Infer a registry type from an array of collections\n * Maps collection names to their data types\n */\nexport type InferCollections<T extends readonly Collection[]> = {\n [K in T[number] as K[\"name\"]]: K extends Collection<infer D> ? D : unknown;\n};\n\n// =============================================================================\n// Collection Entry\n// =============================================================================\n\nexport interface CollectionEntry<T = unknown> {\n /** Unique identifier within the collection */\n id: string;\n /** URL-friendly slug */\n slug: string;\n /** Validated frontmatter data */\n data: T;\n /** Raw content body (markdown/mdx) */\n body: string;\n /** Render the content to JSX */\n render: () => Promise<{ Content: () => VNode }>;\n}\n\n// =============================================================================\n// Collection Source\n// =============================================================================\n\nexport interface ChangeSet<T = unknown> {\n /** Cursor for next incremental fetch */\n cursor: string;\n /** Newly added entries */\n added: CollectionEntry<T>[];\n /** Updated entries */\n updated: CollectionEntry<T>[];\n /** Deleted entry IDs */\n deleted: string[];\n}\n\nexport type WatchCallback<T = unknown> = (changes: ChangeSet<T>) => void;\n\nexport interface CollectionSource<T = unknown> {\n /** Unique identifier for this source */\n id: string;\n\n /** Get all entries from this source */\n getEntries(): Promise<CollectionEntry<T>[]>;\n\n /** Get a single entry by ID */\n getEntry(id: string): Promise<CollectionEntry<T> | null>;\n\n /** Watch for changes (optional) */\n watch?(callback: WatchCallback<T>): () => void;\n\n /** Get incremental changes since cursor (optional) */\n getChanges?(since: string): Promise<ChangeSet<T>>;\n}\n\n// =============================================================================\n// Collection Definition\n// =============================================================================\n\nexport interface CollectionConfig<T extends z.ZodType = z.ZodType> {\n /** Collection name */\n name: string;\n /** Data source (returns raw entries, validated against schema later) */\n source: CollectionSource<unknown>;\n /** Zod schema for validation */\n schema: T;\n}\n\nexport interface Collection<T = unknown> {\n name: string;\n source: CollectionSource<unknown>;\n schema: z.ZodType;\n /** Type-only field for inference */\n _outputType?: T;\n}\n\n// =============================================================================\n// Route Configuration\n// =============================================================================\n\nexport interface StaticPath<P = Record<string, string>> {\n params: P;\n props?: Record<string, unknown>;\n}\n\nexport interface RouteConfig<TRegistry extends Record<string, unknown> = Record<string, unknown>> {\n /** Route path pattern (e.g., '/blog/:slug') */\n path: string;\n /** Component to render */\n component: (props: Record<string, unknown>) => VNode;\n /** Static props for the route */\n props?:\n | Record<string, unknown>\n | ((ssg: SSGInstance<TRegistry>) => Promise<Record<string, unknown>>);\n /** Generate static paths for dynamic routes */\n getStaticPaths?: (ssg: SSGInstance<TRegistry>) => Promise<StaticPath[]>;\n}\n\n// =============================================================================\n// MDX Configuration\n// =============================================================================\n\nexport interface MDXConfig {\n /** Remark plugins */\n remarkPlugins?: unknown[];\n /** Rehype plugins */\n rehypePlugins?: unknown[];\n /** Component mapping for MDX */\n components?: Record<string, Component>;\n}\n\n// =============================================================================\n// Document Template\n// =============================================================================\n\n/**\n * Raw HTML VNode that can be used directly in JSX or converted to string\n */\nexport class RawHTML {\n public readonly type = \"div\";\n public readonly props: { dangerouslySetInnerHTML: { __html: string } };\n public readonly children: never[] = [];\n\n constructor(public readonly html: string) {\n this.props = { dangerouslySetInnerHTML: { __html: html } };\n }\n\n toString(): string {\n return this.html;\n }\n}\n\nexport interface DocumentProps {\n /** Rendered page content (VNode with toString) */\n children: RawHTML;\n /** Page title */\n title?: string;\n /** Base URL path */\n base: string;\n /** Route path */\n path: string;\n /** Route props */\n props: Record<string, unknown>;\n /** Script tags for islands (as RawHTML) */\n scripts?: RawHTML;\n /** CSS stylesheet paths */\n css?: string[];\n}\n\nexport type DocumentTemplate = (props: DocumentProps) => VNode;\n\n// =============================================================================\n// SSG Configuration\n// =============================================================================\n\nexport interface SSGConfig<\n TCollections extends readonly Collection[] = Collection[],\n TRegistry extends Record<string, unknown> = InferCollections<TCollections>,\n> {\n /** Output directory for built files */\n outDir: string;\n /** Root directory for resolving relative paths (defaults to script location) */\n rootDir?: string;\n /** Base URL path */\n base?: string;\n /** Collections to include */\n collections?: TCollections;\n /** Route definitions */\n routes?: RouteConfig<TRegistry>[];\n /** MDX configuration */\n mdx?: MDXConfig;\n /** Custom document template */\n document?: DocumentTemplate;\n}\n\n// =============================================================================\n// Build State & Result\n// =============================================================================\n\nexport interface BuildState {\n /** Cursor for each collection */\n cursors: Record<string, string>;\n /** Content hash for each page */\n pageHashes: Record<string, string>;\n /** Last build timestamp */\n timestamp: number;\n}\n\nexport interface BuildResult {\n /** New build state for incremental builds */\n state: BuildState;\n /** Paths that were built */\n paths: string[];\n /** Build statistics */\n stats: {\n added: number;\n updated: number;\n deleted: number;\n unchanged: number;\n };\n}\n\nexport interface BuildOptions {\n /** Enable incremental build */\n incremental?: boolean;\n /** Previous build state */\n state?: BuildState;\n /** Only build specific collections */\n collections?: string[];\n}\n\n// =============================================================================\n// Watcher\n// =============================================================================\n\nexport interface WatchOptions {\n /** Callback when rebuild completes */\n onRebuild?: (result: BuildResult) => void;\n /** Callback on error */\n onError?: (error: Error) => void;\n}\n\nexport interface Watcher {\n /** Stop watching */\n close(): void;\n}\n\n// =============================================================================\n// SSG Instance\n// =============================================================================\n\nexport interface SSGInstance<TRegistry extends Record<string, unknown> = Record<string, unknown>> {\n /** Get the root directory for resolving paths */\n getRootDir(): string;\n\n /** Get all entries from a collection */\n getCollection<K extends keyof TRegistry & string>(\n name: K,\n ): Promise<CollectionEntry<TRegistry[K]>[]>;\n\n /** Get a single entry from a collection */\n getEntry<K extends keyof TRegistry & string>(\n name: K,\n id: string,\n ): Promise<CollectionEntry<TRegistry[K]> | null>;\n\n /** Build the static site */\n build(options?: BuildOptions): Promise<BuildResult>;\n\n /** Watch for changes and rebuild */\n watch(options?: WatchOptions): Watcher;\n}\n","import { compile } from \"@mdx-js/mdx\";\nimport type { Pluggable } from \"unified\";\nimport type { VNode } from \"@semajsx/core\";\nimport type { MDXConfig, MDXCompileResult, Heading } from \"./types\";\n\n/**\n * MDX Processor for compiling MDX content to JSX components\n */\nexport class MDXProcessor {\n private config: MDXConfig;\n\n constructor(config: MDXConfig = {}) {\n this.config = config;\n }\n\n /**\n * Compile MDX content to a JSX component\n */\n async compile(\n content: string,\n frontmatter: Record<string, unknown> = {},\n ): Promise<MDXCompileResult> {\n // Extract headings for table of contents\n const headings = this.extractHeadings(content);\n\n // Compile MDX to JavaScript\n const compiled = await compile(content, {\n outputFormat: \"function-body\",\n development: false,\n remarkPlugins: (this.config.remarkPlugins ?? []) as Pluggable[],\n rehypePlugins: (this.config.rehypePlugins ?? []) as Pluggable[],\n // Use SemaJSX runtime\n jsxImportSource: \"@semajsx/dom\",\n });\n\n // Dynamic import of JSX runtime\n const jsxRuntime = await import(\"@semajsx/dom/jsx-runtime\");\n\n // Create the Content component\n const Content = this.createComponent(\n String(compiled),\n this.config.components ?? {},\n jsxRuntime,\n );\n\n return {\n Content,\n frontmatter,\n headings,\n };\n }\n\n /**\n * Create a component from compiled MDX code\n */\n private createComponent(\n code: string,\n components: Record<string, (props: Record<string, unknown>) => VNode>,\n jsxRuntime: unknown,\n ): (props?: Record<string, unknown>) => VNode {\n // Import JSX runtime\n // This will be resolved at runtime\n return (props: Record<string, unknown> = {}) => {\n try {\n // Create a function from the MDX compiled code\n // MDX compiled code expects jsx runtime in arguments[0]\n // By using new Function() with no parameters, we can pass\n // the runtime via call() and it becomes arguments[0]\n // eslint-disable-next-line @typescript-eslint/no-implied-eval\n const fn = new Function(code + \"\\nreturn MDXContent;\");\n\n // Call with jsxRuntime as arguments[0]\n // MDX returns an object with default export\n const result = fn.call(null, jsxRuntime) as {\n default: (props: Record<string, unknown>) => VNode;\n };\n return result.default({ ...props, components });\n } catch (e) {\n // Fallback for when runtime is not available\n throw new Error(`MDX rendering failed: ${(e as Error).message}`);\n }\n };\n }\n\n /**\n * Extract headings from markdown content\n */\n private extractHeadings(content: string): Heading[] {\n const headings: Heading[] = [];\n const headingRegex = /^(#{1,6})\\s+(.+)$/gm;\n\n let match;\n while ((match = headingRegex.exec(content)) !== null) {\n const hashes = match[1];\n const rawText = match[2];\n if (!hashes || !rawText) continue;\n\n const depth = hashes.length;\n const text = rawText.trim();\n const slug = this.slugify(text);\n\n headings.push({ depth, text, slug });\n }\n\n return headings;\n }\n\n /**\n * Convert text to URL-friendly slug\n */\n private slugify(text: string): string {\n return text\n .toLowerCase()\n .replace(/[^\\w\\s-]/g, \"\")\n .replace(/\\s+/g, \"-\")\n .replace(/-+/g, \"-\")\n .trim();\n }\n}\n\n/**\n * Create an MDX processor instance\n */\nexport function createMDXProcessor(config?: MDXConfig): MDXProcessor {\n return new MDXProcessor(config);\n}\n","import { compile } from \"@mdx-js/mdx\";\nimport type { Plugin, PluginOption } from \"vite\";\nimport type { Pluggable } from \"unified\";\n\n/**\n * MDX plugin options\n */\nexport interface MDXPluginOptions {\n /** Remark plugins */\n remarkPlugins?: unknown[];\n /** Rehype plugins */\n rehypePlugins?: unknown[];\n}\n\n/**\n * Vite plugin for MDX support\n * Transforms .mdx files to JSX modules\n */\nexport function viteMDXPlugin(options: MDXPluginOptions = {}): PluginOption {\n const plugin: Plugin = {\n name: \"semajsx-mdx\",\n\n async transform(code: string, id: string) {\n // Only transform .mdx files\n if (!id.endsWith(\".mdx\")) {\n return null;\n }\n\n try {\n // Compile MDX to JavaScript (not JSX)\n const compiled = await compile(code, {\n jsxImportSource: \"@semajsx/dom\",\n outputFormat: \"program\",\n development: false,\n remarkPlugins: (options.remarkPlugins ?? []) as Pluggable[],\n rehypePlugins: (options.rehypePlugins ?? []) as Pluggable[],\n });\n\n return {\n code: String(compiled),\n map: null,\n };\n } catch (error) {\n const err = error as Error;\n throw new Error(`MDX compilation failed for ${id}: ${err.message}`);\n }\n },\n };\n\n return plugin;\n}\n","import { mkdir, writeFile, rm } from \"fs/promises\";\nimport { join, dirname, resolve } from \"path\";\nimport { createApp, renderDocument } from \"@semajsx/ssr\";\nimport type { App, RouteContext } from \"@semajsx/ssr\";\nimport { DefaultDocument } from \"./document\";\nimport type { VNode } from \"@semajsx/core\";\nimport {\n RawHTML,\n type SSGConfig,\n type SSGInstance,\n type Collection,\n type CollectionEntry,\n type BuildOptions,\n type BuildResult,\n type BuildState,\n type WatchOptions,\n type Watcher,\n type DocumentProps,\n type InferCollections,\n} from \"./types\";\nimport { viteMDXPlugin } from \"./mdx\";\n\n/**\n * SSG (Static Site Generator) core class\n * Built on top of server's createApp\n */\nexport class SSG<\n TRegistry extends Record<string, unknown> = Record<string, unknown>,\n> implements SSGInstance<TRegistry> {\n private config: SSGConfig;\n private rootDir: string;\n private collections: Map<string, Collection>;\n private entriesCache: Map<string, CollectionEntry[]>;\n private app: App;\n private mdxModules: Map<string, string> = new Map();\n\n constructor(config: SSGConfig) {\n // Resolve rootDir\n this.rootDir = config.rootDir ?? process.cwd();\n\n this.config = {\n base: \"/\",\n ...config,\n outDir: resolve(this.rootDir, config.outDir),\n };\n this.collections = new Map();\n this.entriesCache = new Map();\n\n // Create App with MDX plugins\n this.app = createApp({\n root: this.rootDir,\n vite: {\n plugins: [\n // Virtual MDX content modules\n {\n name: \"ssg-virtual-mdx\",\n resolveId: (id: string) => {\n if (id.startsWith(\"virtual:mdx:\")) {\n return \"\\0\" + id;\n }\n },\n load: (id: string) => {\n if (id.startsWith(\"\\0virtual:mdx:\")) {\n const mdxId = id.replace(\"\\0virtual:mdx:\", \"\");\n return this.mdxModules.get(mdxId);\n }\n },\n },\n // MDX compiler plugin\n viteMDXPlugin(config.mdx ?? {}),\n ],\n },\n });\n\n // Register collections\n for (const collection of config.collections ?? []) {\n this.collections.set(collection.name, collection);\n }\n }\n\n getRootDir(): string {\n return this.rootDir;\n }\n\n async getCollection<K extends keyof TRegistry & string>(\n name: K,\n ): Promise<CollectionEntry<TRegistry[K]>[]> {\n const collection = this.collections.get(name);\n if (!collection) {\n throw new Error(`Collection \"${name}\" not found`);\n }\n\n if (this.entriesCache.has(name)) {\n return this.entriesCache.get(name) as CollectionEntry<TRegistry[K]>[];\n }\n\n const entries = await collection.source.getEntries();\n\n const validatedEntries = entries.map((entry) => {\n const result = collection.schema.safeParse(entry.data);\n if (!result.success) {\n throw new Error(`Validation error in ${name}/${entry.id}: ${result.error.message}`);\n }\n\n return {\n ...entry,\n data: result.data,\n render: async () => {\n // Get Vite server from app\n const vite = this.app.getViteServer();\n if (!vite) {\n throw new Error(\"Vite server not initialized\");\n }\n\n // Store MDX content as virtual module\n const mdxId = `${name}/${entry.id}.mdx`;\n this.mdxModules.set(mdxId, entry.body);\n\n try {\n // Load module through Vite SSR\n const moduleExports = (await vite.ssrLoadModule(`virtual:mdx:${mdxId}`)) as {\n default: (props: Record<string, unknown>) => unknown;\n };\n\n const Content = (props: Record<string, unknown> = {}): VNode =>\n moduleExports.default({\n ...props,\n components: this.config.mdx?.components ?? {},\n }) as VNode;\n\n return {\n Content,\n headings: this.extractHeadings(entry.body),\n };\n } finally {\n this.mdxModules.delete(mdxId);\n }\n },\n };\n });\n\n this.entriesCache.set(name, validatedEntries);\n return validatedEntries as CollectionEntry<TRegistry[K]>[];\n }\n\n async getEntry<K extends keyof TRegistry & string>(\n name: K,\n id: string,\n ): Promise<CollectionEntry<TRegistry[K]> | null> {\n const entries = await this.getCollection(name);\n return entries.find((e) => e.id === id || e.slug === id) ?? null;\n }\n\n async build(options: BuildOptions = {}): Promise<BuildResult> {\n const { incremental = false, state: prevState } = options;\n const outDir = this.config.outDir;\n\n // Initialize App (starts Vite)\n await this.app.prepare();\n\n try {\n // Register routes with App\n await this.registerRoutes();\n\n // Build all pages\n const result = await this.buildPages(incremental, prevState, outDir);\n\n // Build islands for client-side hydration\n await this.app.build({\n outDir,\n mode: \"full\",\n minify: true,\n vite: {\n build: {\n rollupOptions: {\n // Don't externalize for SSG - bundle everything\n external: [],\n },\n },\n },\n });\n\n return result;\n } finally {\n await this.app.close();\n }\n }\n\n private async registerRoutes(): Promise<void> {\n const routes = this.config.routes ?? [];\n\n for (const route of routes) {\n if (route.getStaticPaths) {\n // Dynamic route - register each path\n const staticPaths = await route.getStaticPaths(this);\n for (const sp of staticPaths) {\n const path = this.applyParams(route.path, sp.params);\n const props: Record<string, unknown> = { ...sp.props, params: sp.params };\n\n this.app.route(\n path,\n (_context: RouteContext) => {\n return route.component(props);\n },\n { title: props.title as string | undefined },\n );\n }\n } else {\n // Static route\n let props: Record<string, unknown> = {};\n if (typeof route.props === \"function\") {\n props = await route.props(this);\n } else if (route.props) {\n props = route.props;\n }\n\n this.app.route(\n route.path,\n (_context: RouteContext) => {\n return route.component(props);\n },\n { title: props.title as string | undefined },\n );\n }\n }\n }\n\n private async buildPages(\n incremental: boolean,\n prevState: BuildState | undefined,\n outDir: string,\n ): Promise<BuildResult> {\n const state: BuildState = {\n cursors: {},\n pageHashes: {},\n timestamp: Date.now(),\n };\n\n const stats = { added: 0, updated: 0, deleted: 0, unchanged: 0 };\n const builtPaths: string[] = [];\n\n if (!incremental) {\n await rm(outDir, { recursive: true, force: true });\n }\n await mkdir(outDir, { recursive: true });\n\n this.entriesCache.clear();\n\n // Get all paths to build\n const allPaths = await this.generateAllPaths();\n const currentPaths = new Set(allPaths.map((p) => p.path));\n\n // Delete removed pages\n if (incremental && prevState) {\n for (const oldPath of Object.keys(prevState.pageHashes)) {\n if (!currentPaths.has(oldPath)) {\n const filePath = this.pathToFilePath(oldPath);\n try {\n await rm(join(outDir, filePath));\n stats.deleted++;\n } catch {\n // ignore\n }\n }\n }\n }\n\n // Build each page\n for (const { path, props } of allPaths) {\n const html = await this.renderPage(path, props);\n const hash = this.hashContent(html);\n\n const prevHash = prevState?.pageHashes[path];\n const needsWrite = !incremental || !prevHash || prevHash !== hash;\n\n if (needsWrite) {\n const filePath = this.pathToFilePath(path);\n const fullPath = join(outDir, filePath);\n\n await mkdir(dirname(fullPath), { recursive: true });\n await writeFile(fullPath, html);\n\n builtPaths.push(path);\n if (!prevHash) {\n stats.added++;\n } else {\n stats.updated++;\n }\n } else {\n stats.unchanged++;\n }\n\n state.pageHashes[path] = hash;\n }\n\n for (const [name, collection] of this.collections) {\n if (collection.source.getChanges) {\n state.cursors[name] = Date.now().toString();\n }\n }\n\n return { state, paths: builtPaths, stats };\n }\n\n private async renderPage(path: string, props: Record<string, unknown>): Promise<string> {\n // Use App to render the page\n const result = await this.app.render(path);\n\n // Wrap with document template\n const documentProps: DocumentProps = {\n children: new RawHTML(result.html),\n title: props.title as string | undefined,\n base: this.config.base ?? \"/\",\n path,\n props,\n scripts: result.scripts ? new RawHTML(result.scripts) : undefined,\n css: result.css.length > 0 ? result.css : undefined,\n };\n\n const template = this.config.document ?? DefaultDocument;\n const documentVNode = template(documentProps);\n\n return renderDocument(documentVNode);\n }\n\n private async generateAllPaths(): Promise<\n Array<{ path: string; props: Record<string, unknown> }>\n > {\n const paths: Array<{ path: string; props: Record<string, unknown> }> = [];\n const routes = this.config.routes ?? [];\n\n for (const route of routes) {\n if (route.getStaticPaths) {\n const staticPaths = await route.getStaticPaths(this);\n for (const sp of staticPaths) {\n const path = this.applyParams(route.path, sp.params);\n paths.push({ path, props: { ...sp.props, params: sp.params } });\n }\n } else {\n let props: Record<string, unknown> = {};\n if (typeof route.props === \"function\") {\n props = await route.props(this);\n } else if (route.props) {\n props = route.props;\n }\n paths.push({ path: route.path, props });\n }\n }\n\n return paths;\n }\n\n watch(options: WatchOptions = {}): Watcher {\n const unsubscribers: (() => void)[] = [];\n\n for (const [name, collection] of this.collections) {\n if (collection.source.watch) {\n const unsubscribe = collection.source.watch(async () => {\n try {\n this.entriesCache.delete(name);\n const result = await this.build({ incremental: true });\n options.onRebuild?.(result);\n } catch (error) {\n options.onError?.(error as Error);\n }\n });\n unsubscribers.push(unsubscribe);\n }\n }\n\n return {\n close: () => unsubscribers.forEach((fn) => fn()),\n };\n }\n\n private pathToFilePath(urlPath: string): string {\n if (urlPath === \"/\") return \"index.html\";\n return `${urlPath.slice(1)}/index.html`;\n }\n\n private applyParams(pattern: string, params: Record<string, string>): string {\n let path = pattern;\n for (const [key, value] of Object.entries(params)) {\n path = path.replace(`:${key}`, value);\n }\n return path;\n }\n\n private hashContent(content: string): string {\n let hash = 0;\n for (let i = 0; i < content.length; i++) {\n const char = content.charCodeAt(i);\n hash = (hash << 5) - hash + char;\n hash = hash & hash;\n }\n return hash.toString(16);\n }\n\n private extractHeadings(content: string): Array<{ depth: number; text: string; slug: string }> {\n const headings: Array<{ depth: number; text: string; slug: string }> = [];\n const regex = /^(#{1,6})\\s+(.+)$/gm;\n\n let match;\n while ((match = regex.exec(content)) !== null) {\n if (!match[1] || !match[2]) continue;\n const depth = match[1].length;\n const text = match[2].trim();\n const slug = text\n .toLowerCase()\n .replace(/[^\\w\\s-]/g, \"\")\n .replace(/\\s+/g, \"-\");\n headings.push({ depth, text, slug });\n }\n\n return headings;\n }\n}\n\nexport function createSSG<\n const TCollections extends readonly Collection[],\n TRegistry extends Record<string, unknown> = InferCollections<TCollections>,\n>(config: SSGConfig<TCollections, TRegistry>): SSGInstance<TRegistry> {\n return new SSG<TRegistry>(config as unknown as SSGConfig);\n}\n","import type { z } from \"zod\";\nimport type { Collection, CollectionConfig } from \"../types\";\n\n/**\n * Define a collection with schema validation\n */\nexport function defineCollection<T extends z.ZodType>(\n config: CollectionConfig<T>,\n): Collection<z.infer<T>> {\n return {\n name: config.name,\n source: config.source,\n schema: config.schema,\n };\n}\n\nexport type { Collection, CollectionConfig, CollectionEntry } from \"../types\";\n","import type { CollectionSource, CollectionEntry, ChangeSet, WatchCallback } from \"../types\";\n\n/**\n * Base class for collection sources\n */\nexport abstract class BaseSource<T = unknown> implements CollectionSource<T> {\n abstract id: string;\n\n abstract getEntries(): Promise<CollectionEntry<T>[]>;\n\n async getEntry(id: string): Promise<CollectionEntry<T> | null> {\n const entries = await this.getEntries();\n return entries.find((e) => e.id === id) ?? null;\n }\n\n watch?(callback: WatchCallback<T>): () => void;\n\n getChanges?(since: string): Promise<ChangeSet<T>>;\n}\n","import { glob } from \"glob\";\nimport matter from \"gray-matter\";\nimport { readFile, watch as fsWatch } from \"fs/promises\";\nimport { join, relative } from \"path\";\nimport type { CollectionEntry, ChangeSet, WatchCallback } from \"../types\";\nimport type { FileSourceOptions } from \"./types\";\nimport { BaseSource } from \"./base\";\n\n/**\n * File system source for collections\n */\nexport class FileSource<T = unknown> extends BaseSource<T> {\n id: string;\n private directory: string;\n private include: string;\n private shouldWatch: boolean;\n private contentRoot: string;\n\n constructor(options: FileSourceOptions, contentRoot: string = process.cwd()) {\n super();\n this.directory = options.directory;\n this.include = options.include ?? \"**/*.{md,mdx}\";\n this.shouldWatch = options.watch ?? false;\n this.contentRoot = contentRoot;\n this.id = `file:${this.directory}`;\n }\n\n async getEntries(): Promise<CollectionEntry<T>[]> {\n const dir = join(this.contentRoot, this.directory);\n const pattern = join(dir, this.include);\n const files = await glob(pattern);\n\n const entries = await Promise.all(\n files.map(async (filePath) => {\n const content = await readFile(filePath, \"utf-8\");\n const { data, content: body } = matter(content);\n\n const relativePath = relative(dir, filePath);\n const id = relativePath.replace(/\\.(md|mdx)$/, \"\");\n const slug = id.replace(/\\\\/g, \"/\");\n\n return {\n id,\n slug,\n data: data as T,\n body,\n render: async () => {\n // MDX compilation will be handled by the MDX processor\n return {\n Content: () => {\n throw new Error(\"MDX rendering not yet implemented\");\n },\n };\n },\n };\n }),\n );\n\n return entries;\n }\n\n override watch(callback: WatchCallback<T>): () => void {\n if (!this.shouldWatch) {\n return () => {};\n }\n\n const dir = join(this.contentRoot, this.directory);\n const abortController = new AbortController();\n\n const startWatching = async () => {\n try {\n const watcher = fsWatch(dir, {\n recursive: true,\n signal: abortController.signal,\n });\n\n for await (const _event of watcher) {\n // Debounce and collect changes\n const entries = await this.getEntries();\n callback({\n cursor: Date.now().toString(),\n added: [],\n updated: entries,\n deleted: [],\n });\n }\n } catch (err) {\n if ((err as Error).name !== \"AbortError\") {\n throw err;\n }\n }\n };\n\n startWatching();\n\n return () => {\n abortController.abort();\n };\n }\n\n override async getChanges(_since: string): Promise<ChangeSet<T>> {\n // For file source, we do a full reload\n // A more sophisticated implementation could track file mtimes\n const entries = await this.getEntries();\n return {\n cursor: Date.now().toString(),\n added: [],\n updated: entries,\n deleted: [],\n };\n }\n}\n\n/**\n * Create a file system source\n */\nexport function fileSource<T = unknown>(\n options: FileSourceOptions,\n contentRoot?: string,\n): FileSource<T> {\n return new FileSource<T>(options, contentRoot);\n}\n","import { exec } from \"child_process\";\nimport { promisify } from \"util\";\nimport type { CollectionEntry } from \"../types\";\nimport type { GitSourceOptions, GitCommitSourceOptions, GitTagSourceOptions } from \"./types\";\nimport { BaseSource } from \"./base\";\n\nconst execAsync = promisify(exec);\n\n/**\n * Git source for collections\n */\nexport class GitSource<T = unknown> extends BaseSource<T> {\n id: string;\n private options: GitSourceOptions;\n private cwd: string;\n\n constructor(options: GitSourceOptions, cwd: string = process.cwd()) {\n super();\n this.options = options;\n this.cwd = cwd;\n this.id = `git:${options.type}`;\n }\n\n async getEntries(): Promise<CollectionEntry<T>[]> {\n if (this.options.type === \"commits\") {\n return this.getCommits(this.options);\n } else {\n return this.getTags(this.options);\n }\n }\n\n private async getCommits(options: GitCommitSourceOptions): Promise<CollectionEntry<T>[]> {\n const args = [\"log\", \"--format=%H|%s|%an|%ae|%aI\"];\n\n if (options.filter?.since) {\n args.push(`--since=${options.filter.since}`);\n }\n if (options.filter?.until) {\n args.push(`--until=${options.filter.until}`);\n }\n if (options.filter?.author) {\n args.push(`--author=${options.filter.author}`);\n }\n if (options.limit) {\n args.push(`-n`, options.limit.toString());\n }\n if (options.filter?.paths?.length) {\n args.push(\"--\", ...options.filter.paths);\n }\n\n const { stdout } = await execAsync(`git ${args.join(\" \")}`, {\n cwd: this.cwd,\n });\n const lines = stdout.trim().split(\"\\n\").filter(Boolean);\n\n return lines.map((line) => {\n const parts = line.split(\"|\");\n const hash = parts[0] ?? \"\";\n const message = parts[1] ?? \"\";\n const author = parts[2] ?? \"\";\n const email = parts[3] ?? \"\";\n const dateStr = parts[4] ?? \"\";\n\n const data = {\n hash,\n message,\n author,\n email,\n date: new Date(dateStr),\n } as unknown as T;\n\n return {\n id: hash,\n slug: hash.slice(0, 7),\n data,\n body: message,\n render: async () => ({\n Content: () => {\n throw new Error(\"Git commits cannot be rendered as content\");\n },\n }),\n };\n });\n }\n\n private async getTags(options: GitTagSourceOptions): Promise<CollectionEntry<T>[]> {\n const pattern = options.pattern ?? \"*\";\n\n // Get tags with date and message\n const { stdout } = await execAsync(\n `git tag -l \"${pattern}\" --format=\"%(refname:short)|%(objectname:short)|%(creatordate:iso)|%(contents:subject)\"`,\n { cwd: this.cwd },\n );\n\n const lines = stdout.trim().split(\"\\n\").filter(Boolean);\n\n return lines.map((line) => {\n const parts = line.split(\"|\");\n const tag = parts[0] ?? \"\";\n const hash = parts[1] ?? \"\";\n const dateStr = parts[2] ?? \"\";\n const message = parts[3] ?? \"\";\n\n const data = {\n tag,\n hash,\n date: new Date(dateStr),\n message: message || undefined,\n } as unknown as T;\n\n return {\n id: tag,\n slug: tag,\n data,\n body: message,\n render: async () => ({\n Content: () => {\n throw new Error(\"Git tags cannot be rendered as content\");\n },\n }),\n };\n });\n }\n}\n\n/**\n * Create a Git source\n */\nexport function gitSource<T = unknown>(options: GitSourceOptions, cwd?: string): GitSource<T> {\n return new GitSource<T>(options, cwd);\n}\n","import type { CollectionEntry, ChangeSet, WatchCallback } from \"../types\";\nimport type { RemoteSourceOptions, WebhookConfig } from \"./types\";\nimport { BaseSource } from \"./base\";\n\n/**\n * Remote API source for collections\n */\nexport class RemoteSource<T = unknown> extends BaseSource<T> {\n id: string;\n private options: RemoteSourceOptions<T>;\n private pollTimer?: ReturnType<typeof setInterval>;\n\n constructor(options: RemoteSourceOptions<T>, id: string = \"remote\") {\n super();\n this.options = options;\n this.id = `remote:${id}`;\n }\n\n async getEntries(): Promise<CollectionEntry<T>[]> {\n const items = await this.options.fetch();\n\n return items.map((item, index) => {\n const id = (item as Record<string, unknown>).id?.toString() ?? index.toString();\n const slug = (item as Record<string, unknown>).slug?.toString() ?? id;\n\n return {\n id,\n slug,\n data: item,\n body: (item as Record<string, unknown>).content?.toString() ?? \"\",\n render: async () => ({\n Content: () => {\n throw new Error(\"Remote content rendering not yet implemented\");\n },\n }),\n };\n });\n }\n\n override async getEntry(id: string): Promise<CollectionEntry<T> | null> {\n if (this.options.fetchOne) {\n const item = await this.options.fetchOne(id);\n if (!item) return null;\n\n const slug = (item as Record<string, unknown>).slug?.toString() ?? id;\n\n return {\n id,\n slug,\n data: item,\n body: (item as Record<string, unknown>).content?.toString() ?? \"\",\n render: async () => ({\n Content: () => {\n throw new Error(\"Remote content rendering not yet implemented\");\n },\n }),\n };\n }\n\n return super.getEntry(id);\n }\n\n override watch(callback: WatchCallback<T>): () => void {\n if (this.options.pollInterval) {\n this.pollTimer = setInterval(async () => {\n const entries = await this.getEntries();\n callback({\n cursor: Date.now().toString(),\n added: [],\n updated: entries,\n deleted: [],\n });\n }, this.options.pollInterval);\n\n return () => {\n if (this.pollTimer) {\n clearInterval(this.pollTimer);\n }\n };\n }\n\n return () => {};\n }\n\n override async getChanges(since: string): Promise<ChangeSet<T>> {\n if (this.options.fetchChanges) {\n return this.options.fetchChanges(since);\n }\n\n // Fallback to full reload\n const entries = await this.getEntries();\n return {\n cursor: Date.now().toString(),\n added: [],\n updated: entries,\n deleted: [],\n };\n }\n\n /**\n * Get webhook configuration for external integration\n */\n getWebhookConfig(): WebhookConfig | undefined {\n return this.options.webhook;\n }\n}\n\n/**\n * Create a remote API source\n */\nexport function remoteSource<T = unknown>(\n options: RemoteSourceOptions<T>,\n id?: string,\n): RemoteSource<T> {\n return new RemoteSource<T>(options, id);\n}\n","import type { CollectionEntry, ChangeSet, WatchCallback } from \"../types\";\nimport type { CustomSourceOptions } from \"./types\";\nimport { BaseSource } from \"./base\";\n\n/**\n * Custom source for collections\n */\nexport class CustomSource<T = unknown> extends BaseSource<T> {\n id: string;\n private options: CustomSourceOptions<T>;\n\n constructor(options: CustomSourceOptions<T>) {\n super();\n this.options = options;\n this.id = options.id;\n }\n\n async getEntries(): Promise<CollectionEntry<T>[]> {\n const items = await this.options.getEntries();\n\n return items.map((item, index) => {\n const id = (item as Record<string, unknown>).id?.toString() ?? index.toString();\n const slug = (item as Record<string, unknown>).slug?.toString() ?? id;\n\n return {\n id,\n slug,\n data: item,\n body: (item as Record<string, unknown>).body?.toString() ?? \"\",\n render: async () => ({\n Content: () => {\n throw new Error(\"Custom content rendering not yet implemented\");\n },\n }),\n };\n });\n }\n\n override async getEntry(id: string): Promise<CollectionEntry<T> | null> {\n if (this.options.getEntry) {\n const item = await this.options.getEntry(id);\n if (!item) return null;\n\n const slug = (item as Record<string, unknown>).slug?.toString() ?? id;\n\n return {\n id,\n slug,\n data: item,\n body: (item as Record<string, unknown>).body?.toString() ?? \"\",\n render: async () => ({\n Content: () => {\n throw new Error(\"Custom content rendering not yet implemented\");\n },\n }),\n };\n }\n\n return super.getEntry(id);\n }\n\n override watch(callback: WatchCallback<T>): () => void {\n if (this.options.watch) {\n return this.options.watch(callback);\n }\n return () => {};\n }\n\n override async getChanges(since: string): Promise<ChangeSet<T>> {\n if (this.options.getChanges) {\n return this.options.getChanges(since);\n }\n\n const entries = await this.getEntries();\n return {\n cursor: Date.now().toString(),\n added: [],\n updated: entries,\n deleted: [],\n };\n }\n}\n\n/**\n * Create a custom source\n */\nexport function createSource<T = unknown>(options: CustomSourceOptions<T>): CustomSource<T> {\n return new CustomSource<T>(options);\n}\n","import type { SSGInstance, BuildResult } from \"../types\";\n\nexport interface WebhookHandlerOptions {\n /** SSG instance to trigger builds */\n ssg: SSGInstance;\n /** Callback when build is triggered */\n onTrigger?: (collection: string, result: BuildResult) => void | Promise<void>;\n /** Callback on error */\n onError?: (error: Error) => void;\n}\n\nexport interface WebhookRequest {\n /** Collection name from URL path */\n collection: string;\n /** Request body */\n body: unknown;\n /** Request headers */\n headers: Record<string, string>;\n}\n\nexport interface WebhookResponse {\n status: number;\n body: string;\n}\n\n/**\n * Create a webhook handler for triggering SSG builds\n */\nexport function createWebhookHandler(\n options: WebhookHandlerOptions,\n): (req: WebhookRequest) => Promise<WebhookResponse> {\n const { ssg, onTrigger, onError } = options;\n\n return async (req: WebhookRequest): Promise<WebhookResponse> => {\n try {\n const { collection } = req;\n\n // Trigger incremental build for the collection\n const result = await ssg.build({\n incremental: true,\n collections: [collection],\n });\n\n // Call trigger callback\n if (onTrigger) {\n await onTrigger(collection, result);\n }\n\n return {\n status: 200,\n body: JSON.stringify({\n success: true,\n paths: result.paths,\n stats: result.stats,\n }),\n };\n } catch (error) {\n if (onError) {\n onError(error as Error);\n }\n\n return {\n status: 500,\n body: JSON.stringify({\n success: false,\n error: (error as Error).message,\n }),\n };\n }\n };\n}\n\n/**\n * Verify webhook signature (for secure webhooks)\n */\nexport function verifyWebhookSignature(\n payload: string,\n signature: string,\n secret: string,\n): boolean {\n // Simple HMAC verification\n // In production, use crypto.timingSafeEqual\n const crypto = require(\"crypto\");\n const expectedSignature = crypto.createHmac(\"sha256\", secret).update(payload).digest(\"hex\");\n\n return signature === `sha256=${expectedSignature}`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAa,mBAAqC,EAChD,UACA,QAAQ,YACR,SACA,UAEA,qBAAC;CAAK,MAAK;YACT,qBAAC;EACC,oBAAC,UAAK,SAAQ,UAAU;EACxB,oBAAC;GAAK,MAAK;GAAW,SAAQ;IAA0C;EACxE,oBAAC,qBAAO,QAAc;EACrB,KAAK,KAAK,SACT,oBAAC;GAAK,KAAI;GAAmB;IAAQ,CACrC;KACG,EACP,qBAAC,qBACE,UACA,WACI;EACF;;;;;;;ACuGT,IAAa,UAAb,MAAqB;CAKnB,YAAY,AAAgB,MAAc;EAAd;cAJL;kBAEa,EAAE;AAGpC,OAAK,QAAQ,EAAE,yBAAyB,EAAE,QAAQ,MAAM,EAAE;;CAG5D,WAAmB;AACjB,SAAO,KAAK;;;;;;;;;ACnIhB,IAAa,eAAb,MAA0B;CAGxB,YAAY,SAAoB,EAAE,EAAE;AAClC,OAAK,SAAS;;;;;CAMhB,MAAM,QACJ,SACA,cAAuC,EAAE,EACd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AAI;GACF,MAAM,EAAE,eAAe;GAGvB,MAAM,SAAS,MAAM,IAAI,MAAM;IAC7B,aAAa;IACb,aAAa,CAAC,WAAW;IAC1B,CAAC;AAGF,OAAI,UACF,OAAM,UAAU,YAAY,OAAO;AAGrC,UAAO;IACL,QAAQ;IACR,MAAM,KAAK,UAAU;KACnB,SAAS;KACT,OAAO,OAAO;KACd,OAAO,OAAO;KACf,CAAC;IACH;WACM,OAAO;AACd,OAAI,QACF,SAAQ,MAAe;AAGzB,UAAO;IACL,QAAQ;IACR,MAAM,KAAK,UAAU;KACnB,SAAS;KACT,OAAQ,MAAgB;KACzB,CAAC;IACH;;;;;;;AAQP,SAAgB,uBACd,SACA,WACA,QACS;AAMT,QAAO,cAAc,oBAHE,SAAS,CACC,WAAW,UAAU,OAAO,CAAC,OAAO,QAAQ,CAAC,OAAO,MAAM"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../ssg/src/watcher/webhook.ts"],"sourcesContent":["import type { SSGInstance, BuildResult } from \"../types\";\n\nexport interface WebhookHandlerOptions {\n /** SSG instance to trigger builds */\n ssg: SSGInstance;\n /** Callback when build is triggered */\n onTrigger?: (collection: string, result: BuildResult) => void | Promise<void>;\n /** Callback on error */\n onError?: (error: Error) => void;\n}\n\nexport interface WebhookRequest {\n /** Collection name from URL path */\n collection: string;\n /** Request body */\n body: unknown;\n /** Request headers */\n headers: Record<string, string>;\n}\n\nexport interface WebhookResponse {\n status: number;\n body: string;\n}\n\n/**\n * Create a webhook handler for triggering SSG builds\n */\nexport function createWebhookHandler(\n options: WebhookHandlerOptions,\n): (req: WebhookRequest) => Promise<WebhookResponse> {\n const { ssg, onTrigger, onError } = options;\n\n return async (req: WebhookRequest): Promise<WebhookResponse> => {\n try {\n const { collection } = req;\n\n // Trigger incremental build for the collection\n const result = await ssg.build({\n incremental: true,\n collections: [collection],\n });\n\n // Call trigger callback\n if (onTrigger) {\n await onTrigger(collection, result);\n }\n\n return {\n status: 200,\n body: JSON.stringify({\n success: true,\n paths: result.paths,\n stats: result.stats,\n }),\n };\n } catch (error) {\n if (onError) {\n onError(error as Error);\n }\n\n return {\n status: 500,\n body: JSON.stringify({\n success: false,\n error: (error as Error).message,\n }),\n };\n }\n };\n}\n\n/**\n * Verify webhook signature (for secure webhooks)\n */\nexport function verifyWebhookSignature(\n payload: string,\n signature: string,\n secret: string,\n): boolean {\n // Simple HMAC verification\n // In production, use crypto.timingSafeEqual\n const crypto = require(\"crypto\");\n const expectedSignature = crypto.createHmac(\"sha256\", secret).update(payload).digest(\"hex\");\n\n return signature === `sha256=${expectedSignature}`;\n}\n"],"mappings":";;;;;;;;;;;;;;AA4BA,SAAgB,qBACd,SACmD;CACnD,MAAM,EAAE,KAAK,WAAW,YAAY;AAEpC,QAAO,OAAO,QAAkD;AAC9D,MAAI;GACF,MAAM,EAAE,eAAe;GAGvB,MAAM,SAAS,MAAM,IAAI,MAAM;IAC7B,aAAa;IACb,aAAa,CAAC,WAAW;IAC1B,CAAC;AAGF,OAAI,UACF,OAAM,UAAU,YAAY,OAAO;AAGrC,UAAO;IACL,QAAQ;IACR,MAAM,KAAK,UAAU;KACnB,SAAS;KACT,OAAO,OAAO;KACd,OAAO,OAAO;KACf,CAAC;IACH;WACM,OAAO;AACd,OAAI,QACF,SAAQ,MAAe;AAGzB,UAAO;IACL,QAAQ;IACR,MAAM,KAAK,UAAU;KACnB,SAAS;KACT,OAAQ,MAAgB;KACzB,CAAC;IACH;;;;;;;AAQP,SAAgB,uBACd,SACA,WACA,QACS;AAMT,QAAO,cAAc,oBAHE,SAAS,CACC,WAAW,UAAU,OAAO,CAAC,OAAO,QAAQ,CAAC,OAAO,MAAM"}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { c as JSXNode, d as VNode, t as Component } from "../../types-CZMcXQTW.mjs";
|
|
2
|
+
import { o as StyleToken } from "../../types-DucvOZQ2.mjs";
|
|
3
|
+
import { _ as SSGPlugin, c as CollectionSource } from "../../types-CGkRxnQB.mjs";
|
|
4
|
+
import { t as LucidePluginOptions } from "../../index-DC3tthWf.mjs";
|
|
5
|
+
|
|
6
|
+
//#region ../ssg/src/plugins/docs-theme/types.d.ts
|
|
7
|
+
interface NavLink {
|
|
8
|
+
/** Display label */
|
|
9
|
+
label: string;
|
|
10
|
+
/** URL path or external URL */
|
|
11
|
+
href: string;
|
|
12
|
+
/** Opens in new tab */
|
|
13
|
+
external?: boolean;
|
|
14
|
+
}
|
|
15
|
+
interface HeroAction {
|
|
16
|
+
/** Button label */
|
|
17
|
+
label: string;
|
|
18
|
+
/** Link URL */
|
|
19
|
+
href: string;
|
|
20
|
+
/** Use primary (filled) button style */
|
|
21
|
+
primary?: boolean;
|
|
22
|
+
}
|
|
23
|
+
interface FeatureItem {
|
|
24
|
+
/** Lucide icon name in kebab-case (e.g., "zap", "package", "shield-check") */
|
|
25
|
+
icon: string;
|
|
26
|
+
/** Feature title */
|
|
27
|
+
title: string;
|
|
28
|
+
/** Feature description */
|
|
29
|
+
description: string;
|
|
30
|
+
}
|
|
31
|
+
interface QuickLinkItem {
|
|
32
|
+
/** Card title */
|
|
33
|
+
title: string;
|
|
34
|
+
/** Card description */
|
|
35
|
+
description: string;
|
|
36
|
+
/** Link URL */
|
|
37
|
+
href: string;
|
|
38
|
+
}
|
|
39
|
+
interface DocsConfig {
|
|
40
|
+
/** Content source for docs */
|
|
41
|
+
source: CollectionSource<unknown>;
|
|
42
|
+
/** URL base path (default: "/docs") */
|
|
43
|
+
basePath?: string;
|
|
44
|
+
/** Index page heading (default: "Documentation") */
|
|
45
|
+
heading?: string;
|
|
46
|
+
/** Index page description */
|
|
47
|
+
description?: string;
|
|
48
|
+
}
|
|
49
|
+
interface GuidesConfig {
|
|
50
|
+
/** Content source for guides */
|
|
51
|
+
source: CollectionSource<unknown>;
|
|
52
|
+
/** URL base path (default: "/guides") */
|
|
53
|
+
basePath?: string;
|
|
54
|
+
/** Index page heading (default: "Guides") */
|
|
55
|
+
heading?: string;
|
|
56
|
+
/** Index page description */
|
|
57
|
+
description?: string;
|
|
58
|
+
}
|
|
59
|
+
interface DocsThemeOptions {
|
|
60
|
+
/** Site title (used in <title> tags and footer copyright) */
|
|
61
|
+
title: string;
|
|
62
|
+
/** Site description for meta tags */
|
|
63
|
+
description?: string;
|
|
64
|
+
/** Navigation bar configuration */
|
|
65
|
+
nav: {
|
|
66
|
+
/** Logo text displayed in the nav bar */logo: string; /** Navigation links */
|
|
67
|
+
links: NavLink[];
|
|
68
|
+
};
|
|
69
|
+
/** Home page hero section (omit to skip hero) */
|
|
70
|
+
hero?: {
|
|
71
|
+
/** Hero heading text */title: string; /** Hero subtitle text */
|
|
72
|
+
subtitle: string; /** Call-to-action buttons */
|
|
73
|
+
actions?: HeroAction[];
|
|
74
|
+
};
|
|
75
|
+
/** Home page features section (omit to skip features) */
|
|
76
|
+
features?: {
|
|
77
|
+
/** Section heading */title: string; /** Section subtitle */
|
|
78
|
+
subtitle: string; /** Feature cards */
|
|
79
|
+
items: FeatureItem[];
|
|
80
|
+
};
|
|
81
|
+
/** Home page quick links section (omit to skip) */
|
|
82
|
+
quickLinks?: {
|
|
83
|
+
/** Section heading */title: string; /** Section subtitle */
|
|
84
|
+
subtitle: string; /** Link cards */
|
|
85
|
+
items: QuickLinkItem[];
|
|
86
|
+
};
|
|
87
|
+
/** Footer configuration */
|
|
88
|
+
footer?: {
|
|
89
|
+
/** Footer links */links?: NavLink[]; /** Copyright holder name (year is auto-generated) */
|
|
90
|
+
copyright?: string;
|
|
91
|
+
};
|
|
92
|
+
/** Docs collection (omit to disable docs section) */
|
|
93
|
+
docs?: DocsConfig;
|
|
94
|
+
/** Guides collection (omit to disable guides section) */
|
|
95
|
+
guides?: GuidesConfig;
|
|
96
|
+
/** Additional MDX plugins and components */
|
|
97
|
+
mdx?: {
|
|
98
|
+
remarkPlugins?: unknown[];
|
|
99
|
+
rehypePlugins?: unknown[]; /** Extra MDX components (merged with theme defaults) */
|
|
100
|
+
components?: Record<string, Component>;
|
|
101
|
+
};
|
|
102
|
+
/** Lucide icon plugin options. Set to `false` to disable. Enabled by default. */
|
|
103
|
+
lucide?: LucidePluginOptions | false;
|
|
104
|
+
}
|
|
105
|
+
//#endregion
|
|
106
|
+
//#region ../ui/src/components/callout/callout.d.ts
|
|
107
|
+
type ClassValue = string | StyleToken | ClassValue[] | false | null | undefined;
|
|
108
|
+
type CalloutType = "info" | "warning" | "success" | "error" | "tip";
|
|
109
|
+
interface CalloutProps {
|
|
110
|
+
/** Semantic type controlling color and icon */
|
|
111
|
+
type?: CalloutType;
|
|
112
|
+
/** Optional title displayed above content */
|
|
113
|
+
title?: string;
|
|
114
|
+
/** Additional CSS class(es) */
|
|
115
|
+
class?: ClassValue;
|
|
116
|
+
/** Content */
|
|
117
|
+
children?: JSXNode;
|
|
118
|
+
}
|
|
119
|
+
declare function Callout(props: CalloutProps): JSXNode;
|
|
120
|
+
//#endregion
|
|
121
|
+
//#region ../ssg/src/plugins/docs-theme/components.d.ts
|
|
122
|
+
interface CodeBlockProps {
|
|
123
|
+
children: string;
|
|
124
|
+
className?: string;
|
|
125
|
+
language?: string;
|
|
126
|
+
}
|
|
127
|
+
declare function CodeBlock({
|
|
128
|
+
children,
|
|
129
|
+
className,
|
|
130
|
+
language
|
|
131
|
+
}: CodeBlockProps): VNode;
|
|
132
|
+
//#endregion
|
|
133
|
+
//#region ../ssg/src/plugins/docs-theme/index.d.ts
|
|
134
|
+
/**
|
|
135
|
+
* Docs theme plugin for SSG.
|
|
136
|
+
*
|
|
137
|
+
* Provides an Apple-inspired documentation site with:
|
|
138
|
+
* - Frosted glass navigation
|
|
139
|
+
* - Home page with hero, features, and quick links
|
|
140
|
+
* - Docs collection with category grouping
|
|
141
|
+
* - Guides collection with difficulty levels
|
|
142
|
+
* - MDX components (Callout, CodeBlock)
|
|
143
|
+
* - Responsive design
|
|
144
|
+
*
|
|
145
|
+
* All text content, navigation links, and site metadata
|
|
146
|
+
* are configured through options — nothing is hardcoded.
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```tsx
|
|
150
|
+
* import { createSSG } from "@semajsx/ssg";
|
|
151
|
+
* import { docsTheme } from "@semajsx/ssg/plugins/docs-theme";
|
|
152
|
+
* import { fileSource } from "@semajsx/ssg";
|
|
153
|
+
*
|
|
154
|
+
* const ssg = createSSG({
|
|
155
|
+
* outDir: "./dist",
|
|
156
|
+
* plugins: [
|
|
157
|
+
* docsTheme({
|
|
158
|
+
* title: "My Docs",
|
|
159
|
+
* nav: {
|
|
160
|
+
* logo: "MyProject",
|
|
161
|
+
* links: [
|
|
162
|
+
* { label: "Docs", href: "/docs" },
|
|
163
|
+
* { label: "GitHub", href: "https://github.com/...", external: true },
|
|
164
|
+
* ],
|
|
165
|
+
* },
|
|
166
|
+
* hero: {
|
|
167
|
+
* title: "MyProject",
|
|
168
|
+
* subtitle: "A great project.",
|
|
169
|
+
* actions: [{ label: "Get Started", href: "/docs/intro", primary: true }],
|
|
170
|
+
* },
|
|
171
|
+
* docs: { source: fileSource({ directory: "content/docs" }, rootDir) },
|
|
172
|
+
* }),
|
|
173
|
+
* ],
|
|
174
|
+
* });
|
|
175
|
+
* ```
|
|
176
|
+
*/
|
|
177
|
+
declare function docsTheme(options: DocsThemeOptions): SSGPlugin[];
|
|
178
|
+
//#endregion
|
|
179
|
+
export { Callout, CodeBlock, type DocsConfig, type DocsThemeOptions, type FeatureItem, type GuidesConfig, type HeroAction, type NavLink, type QuickLinkItem, docsTheme };
|
|
180
|
+
//# sourceMappingURL=docs-theme.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs-theme.d.mts","names":[],"sources":["../../../../ssg/src/plugins/docs-theme/types.ts","../../../../ui/src/components/callout/callout.tsx","../../../../ssg/src/plugins/docs-theme/components.tsx","../../../../ssg/src/plugins/docs-theme/index.ts"],"mappings":";;;;;;UAQiB,OAAA;;EAEf,KAAA;EAFF;EAIE,IAAA;;EAEA,QAAA;AAAA;AAAA,UA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