@ox-content/vite-plugin-svelte 3.1.3 → 3.1.4
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/html-host-client.d.cts +13 -37
- package/dist/html-host-client.d.mts +13 -37
- package/dist/html-host-client2.cjs +13 -195
- package/dist/html-host-client2.d.cts +2 -2
- package/dist/html-host-client2.d.mts +2 -2
- package/dist/html-host-client2.mjs +13 -195
- package/dist/html-host-client2.mjs.map +1 -1
- package/dist/index.cjs +59 -499
- package/dist/index.d.cts +26 -104
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +26 -104
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +75 -512
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["baseTransformMarkdown","compileWithDefaultSvelte","decodeHtmlAttr","path","fs","normalizeMarkdownExtensions","oxContent"],"sources":["../src/transform.ts","../src/environment.ts","../src/components.ts","../src/html-host-default-renderer.ts","../src/html-host.ts","../src/html-host-registry-paths.ts","../src/html-host-renderer.ts","../src/html-host-collection-documents.ts","../src/html-host-registry.ts","../src/index.ts"],"sourcesContent":["import {\n applyIslandSsrHtml,\n discoverDocumentMdxIslands,\n renderIslandComponentImports,\n resolveContentRootPath,\n resolveMdxForFilePath,\n transformMarkdown as baseTransformMarkdown,\n type ResolvedDocumentComponentImport,\n} from \"@ox-content/vite-plugin\";\nimport { compile as compileWithDefaultSvelte } from \"svelte/compiler\";\nimport type {\n ResolvedSvelteOptions,\n SvelteTransformResult,\n ComponentIsland,\n ComponentsMap,\n SvelteCompileFunction,\n SvelteCompilerOption,\n SvelteCompilerResult,\n SvelteCompilerWarning,\n} from \"./types\";\n\nconst COMPONENT_REGEX = /<([A-Z][a-zA-Z0-9]*)\\s*([^>]*?)\\s*(?:\\/>|>([\\s\\S]*?)<\\/\\1>)/g;\nconst PROP_REGEX = /([a-zA-Z0-9-]+)(?:=(?:\"([^\"]*)\"|'([^']*)'|{([^}]*)}|\\[([^\\]]*)\\]))?/g;\n\nconst ISLAND_MARKER_PREFIX = \"OXCONTENT-ISLAND-\";\nconst ISLAND_MARKER_SUFFIX = \"-PLACEHOLDER\";\nconst DOCUMENT_PROP_MARKER_PREFIX = \"OXCONTENT-DOCUMENT-PROP-\";\nconst DOCUMENT_PROP_MARKER_SUFFIX = \"-PLACEHOLDER\";\nconst PAYLOAD_SCRIPT = /^\\s*<script type=\"application\\/json\">[\\s\\S]*?<\\/script>/i;\nconst RUST_PAYLOAD_KEYS = new Set([\"props\", \"expressions\", \"spreads\"]);\n\ninterface Range {\n start: number;\n end: number;\n}\n\nexport async function transformMarkdownWithSvelte(\n code: string,\n id: string,\n options: ResolvedSvelteOptions,\n): Promise<SvelteTransformResult> {\n const components: ComponentsMap = options.components;\n const { content: markdownContent, frontmatter } = extractFrontmatter(code);\n const mdx = resolveMdxForFilePath(id, options.mdx);\n\n const baseOptions = {\n srcDir: options.srcDir,\n outDir: options.outDir,\n base: options.base,\n extensions: options.extensions,\n mdx,\n ssg: {\n enabled: false,\n extension: \".html\",\n clean: false,\n bare: false,\n generateOgImage: false,\n lastUpdated: false,\n pagination: false,\n breadcrumbs: false,\n jsonLd: false,\n readerChrome: false,\n localeSwitcher: false,\n a11y: false,\n pageChrome: false,\n },\n gfm: options.gfm,\n frontmatter: false,\n toc: options.toc,\n tocMaxDepth: options.tocMaxDepth,\n codeAnnotations: options.codeAnnotations,\n footnotes: true,\n tables: true,\n taskLists: true,\n strikethrough: true,\n autolinks: options.autolinks,\n highlight: false,\n mermaid: false,\n ogImage: false,\n ogImageOptions: {\n vuePlugin: \"vitejs\",\n width: 1200,\n height: 630,\n cache: true,\n concurrency: 1,\n },\n transformers: [],\n docs: false,\n ogViewer: false,\n search: {\n enabled: false,\n limit: 10,\n prefix: true,\n placeholder: \"Search...\",\n hotkey: \"k\",\n },\n embeds: options.embeds,\n i18n: false,\n } as unknown as Parameters<typeof baseTransformMarkdown>[2] & {\n codeAnnotations?: ResolvedSvelteOptions[\"codeAnnotations\"];\n };\n\n if (mdx) {\n const documentExpressions = options.mdxDocumentProps\n ? prepareMdxDocumentExpressions(markdownContent, id)\n : { content: markdownContent, expressions: [] };\n const transformed = await baseTransformMarkdown(documentExpressions.content, id, baseOptions);\n const discovered = await discoverDocumentMdxIslands({\n source: markdownContent,\n html: transformed.html,\n components,\n imports: transformed.imports,\n documentPath: id,\n contentRoot: resolveContentRootPath({ srcDir: options.srcDir, root: options.root }),\n srcDir: options.srcDir,\n });\n if (options.mdxDocumentProps) {\n return compileSvelteResult(\n generateMdxDocumentPropsSvelteModule(\n transformed.html,\n discovered.usedComponents,\n frontmatter,\n options,\n id,\n discovered.localBindings,\n documentExpressions.expressions,\n ),\n id,\n discovered.usedComponents,\n frontmatter,\n options,\n );\n }\n const html = options.renderIsland\n ? await applyIslandSsrHtml(\n transformed.html,\n options.renderIsland,\n id,\n discovered.usedComponents,\n )\n : transformed.html;\n return compileSvelteResult(\n generateSvelteModule(\n html,\n discovered.usedComponents,\n discovered.usedComponents,\n frontmatter,\n options,\n id,\n discovered.localBindings,\n ),\n id,\n discovered.usedComponents,\n frontmatter,\n options,\n );\n }\n\n const usedComponents: string[] = [];\n const islands: ComponentIsland[] = [];\n let islandIndex = 0;\n\n const fenceRanges = collectFenceRanges(markdownContent);\n let processedContent = \"\";\n let lastIndex = 0;\n let match: RegExpExecArray | null;\n\n COMPONENT_REGEX.lastIndex = 0;\n while ((match = COMPONENT_REGEX.exec(markdownContent)) !== null) {\n const [fullMatch, componentName, propsString, rawIslandContent] = match;\n const matchStart = match.index;\n const matchEnd = matchStart + fullMatch.length;\n\n if (\n !Object.prototype.hasOwnProperty.call(components, componentName) ||\n isInRanges(matchStart, matchEnd, fenceRanges)\n ) {\n processedContent += markdownContent.slice(lastIndex, matchEnd);\n lastIndex = matchEnd;\n continue;\n }\n\n if (!usedComponents.includes(componentName)) {\n usedComponents.push(componentName);\n }\n\n const props = parseProps(propsString);\n const islandId = `ox-island-${islandIndex++}`;\n const islandContent =\n typeof rawIslandContent === \"string\" ? rawIslandContent.trim() : undefined;\n\n islands.push({\n name: componentName,\n props,\n position: matchStart,\n id: islandId,\n content: islandContent,\n });\n\n processedContent += markdownContent.slice(lastIndex, matchStart) + createIslandMarker(islandId);\n lastIndex = matchEnd;\n }\n processedContent += markdownContent.slice(lastIndex);\n\n const transformed = await baseTransformMarkdown(processedContent, id, baseOptions);\n const htmlWithIslands = injectIslandMarkers(transformed.html, islands);\n return compileSvelteResult(\n generateSvelteModule(htmlWithIslands, usedComponents, islands, frontmatter, options, id),\n id,\n usedComponents,\n frontmatter,\n options,\n );\n}\n\nasync function compileSvelteResult(\n svelteCode: string,\n id: string,\n usedComponents: string[],\n frontmatter: Record<string, unknown>,\n options: ResolvedSvelteOptions,\n): Promise<SvelteTransformResult> {\n const compiler = resolveSvelteCompiler(options.compiler);\n const compiled = normalizeSvelteCompilerResult(\n await compiler(svelteCode, {\n filename: id,\n generate: options.ssr ? \"server\" : \"client\",\n runes: options.runes,\n }),\n id,\n );\n\n return {\n code: `${compiled.code}\\nexport const frontmatter = ${JSON.stringify(frontmatter)};`,\n map: compiled.map,\n warnings: compiled.warnings,\n usedComponents,\n frontmatter,\n };\n}\n\nfunction resolveSvelteCompiler(compiler: SvelteCompilerOption | undefined): SvelteCompileFunction {\n if (!compiler) {\n return compileWithDefaultSvelte as SvelteCompileFunction;\n }\n if (typeof compiler === \"function\") {\n return compiler;\n }\n return compiler.compile;\n}\n\nfunction normalizeSvelteCompilerResult(\n result: Awaited<SvelteCompilerResult>,\n id: string,\n): {\n code: string;\n map: unknown;\n warnings: SvelteCompilerWarning[];\n} {\n let value: unknown = result;\n\n if (typeof value === \"string\") {\n const source = value;\n try {\n value = JSON.parse(source) as unknown;\n } catch {\n return { code: source, map: null, warnings: [] };\n }\n }\n\n if (!value || typeof value !== \"object\") {\n throwUnsupportedCompilerResult(id);\n }\n\n const output = value as {\n js?: unknown;\n warnings?: unknown;\n };\n const js = output.js;\n const warnings = Array.isArray(output.warnings)\n ? (output.warnings as SvelteCompilerWarning[])\n : [];\n\n if (typeof js === \"string\") {\n return { code: js, map: null, warnings };\n }\n\n if (js && typeof js === \"object\") {\n const jsOutput = js as { code?: unknown; map?: unknown };\n if (typeof jsOutput.code === \"string\") {\n return { code: jsOutput.code, map: jsOutput.map ?? null, warnings };\n }\n }\n\n throwUnsupportedCompilerResult(id);\n}\n\nfunction throwUnsupportedCompilerResult(id: string): never {\n throw new Error(\n `[ox-content-svelte] Compiler for ${id} returned an unsupported result. Expected { js: { code } } or a compatible JSON string.`,\n );\n}\n\nfunction createIslandMarker(islandId: string): string {\n return `${ISLAND_MARKER_PREFIX}${islandId}${ISLAND_MARKER_SUFFIX}`;\n}\n\nfunction collectFenceRanges(content: string): Range[] {\n const ranges: Range[] = [];\n let inFence = false;\n let fenceChar = \"\";\n let fenceLength = 0;\n let fenceStart = 0;\n let pos = 0;\n\n while (pos < content.length) {\n const lineEnd = content.indexOf(\"\\n\", pos);\n const next = lineEnd === -1 ? content.length : lineEnd + 1;\n const line = content.slice(pos, lineEnd === -1 ? content.length : lineEnd);\n const fenceMatch = line.match(/^\\s{0,3}([`~]{3,})/);\n\n if (fenceMatch) {\n const marker = fenceMatch[1];\n if (!inFence) {\n inFence = true;\n fenceChar = marker[0];\n fenceLength = marker.length;\n fenceStart = pos;\n } else if (marker[0] === fenceChar && marker.length >= fenceLength) {\n inFence = false;\n ranges.push({ start: fenceStart, end: next });\n fenceChar = \"\";\n fenceLength = 0;\n }\n }\n\n pos = next;\n }\n\n if (inFence) {\n ranges.push({ start: fenceStart, end: content.length });\n }\n\n return ranges;\n}\n\nfunction isInRanges(start: number, end: number, ranges: Range[]): boolean {\n for (const range of ranges) {\n if (start < range.end && end > range.start) {\n return true;\n }\n }\n return false;\n}\n\nfunction injectIslandMarkers(html: string, islands: ComponentIsland[]): string {\n let output = html;\n\n for (const island of islands) {\n const marker = createIslandMarker(island.id);\n const propsAttr =\n Object.keys(island.props).length > 0\n ? ` data-ox-props='${JSON.stringify(island.props).replace(/'/g, \"'\")}'`\n : \"\";\n const contentAttr = island.content\n ? ` data-ox-content='${island.content.replace(/'/g, \"'\")}'`\n : \"\";\n const attrs = `data-ox-island=\"${island.name}\"${propsAttr}${contentAttr}`;\n output = output.replaceAll(`<p>${marker}</p>`, `<div ${attrs}></div>`);\n output = output.replaceAll(marker, `<span ${attrs}></span>`);\n }\n\n return output;\n}\n\nfunction extractFrontmatter(content: string): {\n content: string;\n frontmatter: Record<string, unknown>;\n} {\n const frontmatterRegex = /^---\\n([\\s\\S]*?)\\n---\\n/;\n const match = frontmatterRegex.exec(content);\n\n if (!match) {\n return { content, frontmatter: {} };\n }\n\n const frontmatterStr = match[1];\n const frontmatter: Record<string, unknown> = {};\n\n for (const line of frontmatterStr.split(\"\\n\")) {\n const colonIndex = line.indexOf(\":\");\n if (colonIndex > 0) {\n const key = line.slice(0, colonIndex).trim();\n let value: unknown = line.slice(colonIndex + 1).trim();\n try {\n value = JSON.parse(value as string);\n } catch {\n if (\n typeof value === \"string\" &&\n ((value.startsWith('\"') && value.endsWith('\"')) ||\n (value.startsWith(\"'\") && value.endsWith(\"'\")))\n ) {\n value = value.slice(1, -1);\n }\n }\n frontmatter[key] = value;\n }\n }\n\n return { content: content.slice(match[0].length), frontmatter };\n}\n\nfunction parseProps(propsString: string): Record<string, unknown> {\n const props: Record<string, unknown> = {};\n if (!propsString) return props;\n\n PROP_REGEX.lastIndex = 0;\n let match: RegExpExecArray | null;\n while ((match = PROP_REGEX.exec(propsString)) !== null) {\n const [, name, doubleQuoted, singleQuoted, braceValue, bracketValue] = match;\n if (name) {\n if (doubleQuoted !== undefined) props[name] = doubleQuoted;\n else if (singleQuoted !== undefined) props[name] = singleQuoted;\n else if (braceValue !== undefined) {\n try {\n props[name] = JSON.parse(braceValue);\n } catch {\n props[name] = braceValue;\n }\n } else if (bracketValue !== undefined) {\n try {\n props[name] = JSON.parse(`[${bracketValue}]`);\n } catch {\n props[name] = bracketValue;\n }\n } else props[name] = true;\n }\n }\n return props;\n}\n\ninterface MdxDocumentExpression {\n marker: string;\n expression: string;\n path: string[];\n}\n\ninterface PreparedMdxDocumentExpressions {\n content: string;\n expressions: MdxDocumentExpression[];\n}\n\ninterface MdxIslandRange {\n name: string;\n tag: string;\n openStart: number;\n openEnd: number;\n innerStart: number;\n contentStart: number;\n closeStart: number;\n closeEnd: number;\n propsAttr?: string;\n script?: string;\n}\n\ninterface MdxIslandPayload {\n props: Record<string, unknown>;\n expressions: Record<string, string>;\n spreads: string[];\n}\n\ninterface MdxTemplateContext {\n html: string;\n filePath: string;\n usedComponents: Set<string>;\n expressionsByMarker: Map<string, MdxDocumentExpression>;\n islandRanges: MdxIslandRange[];\n /** Components that carried `oxIsland`, in document order. */\n hydratedIslands: Set<string>;\n}\n\n/** Opt a document-props component into the island contract. */\nconst MDX_ISLAND_DIRECTIVE = \"oxIsland\";\nconst MDX_ISLAND_MEDIA_DIRECTIVE = \"oxIslandMedia\";\nconst MDX_ISLAND_LOAD_STRATEGIES = new Set([\"eager\", \"idle\", \"visible\", \"media\"]);\n\ninterface MdxIslandHydration {\n load: string;\n media?: string;\n}\n\nfunction prepareMdxDocumentExpressions(\n content: string,\n filePath: string,\n): PreparedMdxDocumentExpressions {\n const skipRanges = mergeRanges([\n ...collectFenceRanges(content),\n ...collectInlineCodeRanges(content),\n ...collectMdxEsmLineRanges(content),\n ]);\n const expressions: MdxDocumentExpression[] = [];\n let output = \"\";\n let cursor = 0;\n let rangeIndex = 0;\n let inTag = false;\n let quote: string | null = null;\n\n while (cursor < content.length) {\n const range = skipRanges[rangeIndex];\n if (range && cursor >= range.end) {\n rangeIndex += 1;\n continue;\n }\n if (range && cursor === range.start) {\n output += content.slice(range.start, range.end);\n cursor = range.end;\n continue;\n }\n\n const char = content[cursor]!;\n if (inTag) {\n output += char;\n if (quote) {\n if (char === quote && content[cursor - 1] !== \"\\\\\") {\n quote = null;\n }\n } else if (char === '\"' || char === \"'\") {\n quote = char;\n } else if (char === \">\") {\n inTag = false;\n }\n cursor += 1;\n continue;\n }\n\n if (char === \"<\" && startsHtmlLikeTag(content, cursor)) {\n inTag = true;\n output += char;\n cursor += 1;\n continue;\n }\n\n if (char === \"{\" && content[cursor - 1] !== \"\\\\\") {\n const end = findMdxExpressionEnd(content, cursor + 1);\n if (end !== -1) {\n const expression = content.slice(cursor + 1, end).trim();\n const path = parseDocumentPropPath(expression);\n if (!path) {\n throw new Error(\n `[ox-content-svelte] Unsupported MDX document prop expression \"{${expression}}\" in ${filePath}. Only identifiers and dotted property paths are supported.`,\n );\n }\n const marker = `${DOCUMENT_PROP_MARKER_PREFIX}${expressions.length}${DOCUMENT_PROP_MARKER_SUFFIX}`;\n expressions.push({ marker, expression, path });\n output += marker;\n cursor = end + 1;\n continue;\n }\n }\n\n output += char;\n cursor += 1;\n }\n\n return { content: output, expressions };\n}\n\nfunction collectInlineCodeRanges(content: string): Range[] {\n const ranges: Range[] = [];\n const fenceRanges = collectFenceRanges(content);\n let lineStart = 0;\n\n while (lineStart < content.length) {\n const lineEnd = content.indexOf(\"\\n\", lineStart);\n const end = lineEnd === -1 ? content.length : lineEnd;\n if (!isInRanges(lineStart, end, fenceRanges)) {\n let cursor = lineStart;\n while (cursor < end) {\n const marker = matchBacktickRun(content, cursor);\n if (!marker) {\n cursor += 1;\n continue;\n }\n const close = content.indexOf(marker, cursor + marker.length);\n if (close === -1 || close >= end) {\n cursor += marker.length;\n continue;\n }\n ranges.push({ start: cursor, end: close + marker.length });\n cursor = close + marker.length;\n }\n }\n lineStart = lineEnd === -1 ? content.length : lineEnd + 1;\n }\n\n return ranges;\n}\n\nfunction collectMdxEsmLineRanges(content: string): Range[] {\n const ranges: Range[] = [];\n const fenceRanges = collectFenceRanges(content);\n let lineStart = 0;\n\n while (lineStart < content.length) {\n const lineEnd = content.indexOf(\"\\n\", lineStart);\n const end = lineEnd === -1 ? content.length : lineEnd + 1;\n const contentEnd = lineEnd === -1 ? content.length : lineEnd;\n if (!isInRanges(lineStart, contentEnd, fenceRanges)) {\n const line = content.slice(lineStart, contentEnd).trimStart();\n if (line.startsWith(\"import \") || line.startsWith(\"export \")) {\n ranges.push({ start: lineStart, end });\n }\n }\n lineStart = lineEnd === -1 ? content.length : lineEnd + 1;\n }\n\n return ranges;\n}\n\nfunction mergeRanges(ranges: Range[]): Range[] {\n const sorted = ranges\n .filter((range) => range.end > range.start)\n .sort((left, right) => left.start - right.start || left.end - right.end);\n const merged: Range[] = [];\n\n for (const range of sorted) {\n const previous = merged.at(-1);\n if (previous && range.start <= previous.end) {\n previous.end = Math.max(previous.end, range.end);\n } else {\n merged.push({ ...range });\n }\n }\n\n return merged;\n}\n\nfunction matchBacktickRun(content: string, index: number): string | null {\n if (content[index] !== \"`\") return null;\n let end = index + 1;\n while (content[end] === \"`\") {\n end += 1;\n }\n return content.slice(index, end);\n}\n\nfunction startsHtmlLikeTag(content: string, index: number): boolean {\n const next = content[index + 1];\n return next === \"/\" || next === \"!\" || next === \"?\" || /[A-Za-z]/.test(next ?? \"\");\n}\n\nfunction findMdxExpressionEnd(content: string, start: number): number {\n let depth = 1;\n let quote: string | null = null;\n let escaped = false;\n\n for (let index = start; index < content.length; index += 1) {\n const char = content[index]!;\n if (quote) {\n if (escaped) {\n escaped = false;\n } else if (char === \"\\\\\") {\n escaped = true;\n } else if (char === quote) {\n quote = null;\n }\n continue;\n }\n\n if (char === '\"' || char === \"'\" || char === \"`\") {\n quote = char;\n continue;\n }\n if (char === \"{\") {\n depth += 1;\n continue;\n }\n if (char === \"}\") {\n depth -= 1;\n if (depth === 0) return index;\n }\n }\n\n return -1;\n}\n\nfunction parseDocumentPropPath(expression: string): string[] | null {\n if (\n !/^[A-Za-z_$][\\w$]*(?:\\.[A-Za-z_$][\\w$]*)*$/.test(expression) ||\n RESERVED_DOCUMENT_PROP_WORDS.has(expression)\n ) {\n return null;\n }\n return expression.split(\".\");\n}\n\nconst RESERVED_DOCUMENT_PROP_WORDS = new Set([\n \"false\",\n \"Infinity\",\n \"NaN\",\n \"null\",\n \"this\",\n \"true\",\n \"undefined\",\n]);\n\nfunction generateMdxDocumentPropsSvelteModule(\n html: string,\n usedComponents: string[],\n frontmatter: Record<string, unknown>,\n options: ResolvedSvelteOptions & { root?: string },\n id: string,\n localBindings: ReadonlyMap<string, ResolvedDocumentComponentImport>,\n documentExpressions: readonly MdxDocumentExpression[],\n): string {\n const filePathLiteral = JSON.stringify(id);\n const imports = renderIslandComponentImports(usedComponents, {\n globalComponents: options.components,\n localBindings,\n documentPath: id,\n root: options.root,\n });\n const { template, hydratedIslands } = renderMdxDocumentTemplate(\n html,\n usedComponents,\n id,\n documentExpressions,\n );\n const moduleScript = renderMdxIslandModuleScript(hydratedIslands, imports);\n\n return `${moduleScript}\n<script>\n ${hydratedIslands.length > 0 ? \"\" : imports}\n\n const frontmatter = ${JSON.stringify(frontmatter)};\n export { frontmatter };\n\n let __ox_mdx_props = $props();\n${hydratedIslands.length > 0 ? renderMdxIslandPropsSerializer(filePathLiteral) : \"\"}\n\n function __ox_mdx_document_prop(props, path, expression) {\n const propName = path.join(\".\");\n let value = props;\n for (const segment of path) {\n if (\n value == null ||\n (typeof value !== \"object\" && typeof value !== \"function\") ||\n !(segment in Object(value))\n ) {\n throw new Error('[ox-content-svelte] Missing MDX document prop \"' + propName + '\" in ' + ${filePathLiteral} + ' for expression {' + expression + '}.');\n }\n value = value[segment];\n }\n if (value === undefined) {\n throw new Error('[ox-content-svelte] Missing MDX document prop \"' + propName + '\" in ' + ${filePathLiteral} + ' for expression {' + expression + '}.');\n }\n return value;\n }\n</script>\n\n<div class=\"ox-content\">${template}</div>\n\n<style>\n .ox-content {\n line-height: 1.6;\n }\n</style>\n`;\n}\n\n/**\n * Island wiring for a document-props page.\n *\n * This host never hydrates the whole page — that is the point of the mode — so\n * the runtime cannot be started from `onMount`. It is exported instead, and the\n * host calls it once on the client. Pages with no islands get no module script\n * at all and stay zero-JavaScript.\n */\nfunction renderMdxIslandModuleScript(hydratedIslands: readonly string[], imports: string): string {\n if (hydratedIslands.length === 0) return \"\";\n const registry = hydratedIslands.map((name) => ` ${name},`).join(\"\\n\");\n\n return `\n<script module>\n import { createRawSnippet, hydrate, mount, unmount } from 'svelte';\n import { initIslands, readIslandSlotHtml } from '@ox-content/islands';\n ${imports}\n\n const __ox_island_components = {\n${registry}\n };\n\n export function hydrateIslands(options) {\n return initIslands((element, props) => {\n const Component = __ox_island_components[element.dataset.oxIsland];\n if (!Component) return;\n\n const islandContent = readIslandSlotHtml(element);\n const componentProps = { ...props };\n if (islandContent) {\n componentProps.children = createRawSnippet(() => ({\n render: () => \\`<div>\\${islandContent}</div>\\`,\n }));\n }\n\n const attach = element.dataset.oxSsr === 'true' ? hydrate : mount;\n const instance = attach(Component, { target: element, props: componentProps });\n return () => unmount(instance);\n }, { selector: '[data-ox-island]', ...options });\n }\n</script>`;\n}\n\n/**\n * `JSON.stringify` drops functions and `undefined` silently and throws an\n * opaque error on a cycle, either of which turns into an island that renders\n * but never comes alive. Walking first turns both into a build diagnostic that\n * names the prop.\n */\nfunction renderMdxIslandPropsSerializer(filePathLiteral: string): string {\n return `\n function __ox_mdx_island_props(componentName, props) {\n const seen = new WeakSet();\n const check = (value, path) => {\n const kind = typeof value;\n if (value === null || kind === 'string' || kind === 'number' || kind === 'boolean') return;\n if (kind !== 'object') {\n throw new Error('[ox-content-svelte] Island \"' + componentName + '\" in ' + ${filePathLiteral} + ' received a ' + kind + ' for prop \"' + path + '\", which cannot be serialised for hydration. Pass a JSON value, or drop ${MDX_ISLAND_DIRECTIVE} to keep the component server-only.');\n }\n if (seen.has(value)) {\n throw new Error('[ox-content-svelte] Island \"' + componentName + '\" in ' + ${filePathLiteral} + ' received a circular value for prop \"' + path + '\", which cannot be serialised for hydration.');\n }\n seen.add(value);\n if (Array.isArray(value)) {\n value.forEach((item, index) => check(item, path + '[' + index + ']'));\n return;\n }\n for (const key of Object.keys(value)) check(value[key], path ? path + '.' + key : key);\n };\n for (const key of Object.keys(props)) check(props[key], key);\n return JSON.stringify(props);\n }\n`;\n}\n\nfunction renderMdxDocumentTemplate(\n html: string,\n usedComponents: string[],\n filePath: string,\n documentExpressions: readonly MdxDocumentExpression[],\n): { template: string; hydratedIslands: string[] } {\n const context: MdxTemplateContext = {\n html,\n filePath,\n usedComponents: new Set(usedComponents),\n expressionsByMarker: new Map(\n documentExpressions.map((expression) => [expression.marker, expression] as const),\n ),\n islandRanges: findMdxIslandRanges(html),\n hydratedIslands: new Set(),\n };\n const template = renderHtmlRange(context, 0, html.length);\n return { template, hydratedIslands: [...context.hydratedIslands] };\n}\n\nfunction renderHtmlRange(context: MdxTemplateContext, start: number, end: number): string {\n let output = \"\";\n let cursor = start;\n\n while (cursor < end) {\n const island = findNextIslandRange(context, cursor, end);\n if (!island) {\n output += renderRawHtmlTemplate(context.html.slice(cursor, end), context.expressionsByMarker);\n break;\n }\n\n output += renderRawHtmlTemplate(\n context.html.slice(cursor, island.openStart),\n context.expressionsByMarker,\n );\n output += renderMdxIslandTemplate(context, island);\n cursor = island.closeEnd;\n }\n\n return output;\n}\n\nfunction findNextIslandRange(\n context: MdxTemplateContext,\n cursor: number,\n end: number,\n): MdxIslandRange | null {\n for (const island of context.islandRanges) {\n if (island.openStart < cursor || island.closeEnd > end) {\n continue;\n }\n if (context.usedComponents.has(island.name)) {\n return island;\n }\n }\n return null;\n}\n\nfunction renderRawHtmlTemplate(\n html: string,\n expressionsByMarker: ReadonlyMap<string, MdxDocumentExpression>,\n): string {\n if (!html) return \"\";\n let output = \"\";\n let cursor = 0;\n\n while (cursor < html.length) {\n const next = findNextDocumentExpressionMarker(html, cursor, expressionsByMarker);\n if (!next) {\n output += renderRawHtmlBlock(html.slice(cursor));\n break;\n }\n output += renderRawHtmlBlock(html.slice(cursor, next.index));\n output += renderDocumentExpression(next.expression);\n cursor = next.index + next.expression.marker.length;\n }\n\n return output;\n}\n\nfunction findNextDocumentExpressionMarker(\n html: string,\n start: number,\n expressionsByMarker: ReadonlyMap<string, MdxDocumentExpression>,\n): { index: number; expression: MdxDocumentExpression } | null {\n let nextIndex = -1;\n let nextExpression: MdxDocumentExpression | undefined;\n\n for (const expression of expressionsByMarker.values()) {\n const index = html.indexOf(expression.marker, start);\n if (index !== -1 && (nextIndex === -1 || index < nextIndex)) {\n nextIndex = index;\n nextExpression = expression;\n }\n }\n\n return nextExpression ? { index: nextIndex, expression: nextExpression } : null;\n}\n\nfunction renderRawHtmlBlock(html: string): string {\n return html ? `{@html ${JSON.stringify(html).replaceAll(\"</script\", \"<\\\\/script\")}}` : \"\";\n}\n\nfunction renderDocumentExpression(expression: MdxDocumentExpression): string {\n return `{${documentPropResolverExpression(expression.path, expression.expression)}}`;\n}\n\nfunction renderMdxIslandTemplate(context: MdxTemplateContext, island: MdxIslandRange): string {\n assertSvelteComponentName(island.name, context.filePath);\n const payload = readMdxIslandPayload(island);\n const hydration = takeMdxIslandHydration(payload, island.name, context.filePath);\n const attrs = renderMdxIslandAttributes(payload, context.filePath);\n const children = renderHtmlRange(context, island.contentStart, island.closeStart);\n const element = children\n ? `<${island.name}${attrs}>${children}</${island.name}>`\n : `<${island.name}${attrs} />`;\n\n if (!hydration) return element;\n\n // The component still renders server-side, inside the wrapper, so the island\n // runtime can hydrate the existing DOM instead of mounting a second copy.\n context.hydratedIslands.add(island.name);\n const wrapperAttrs = [\n `data-ox-island=\"${island.name}\"`,\n 'data-ox-ssr=\"true\"',\n `data-ox-load=\"${hydration.load}\"`,\n ];\n if (hydration.media) wrapperAttrs.push(`data-ox-media=${JSON.stringify(hydration.media)}`);\n wrapperAttrs.push(\n `data-ox-props={${mdxIslandPropsExpression(payload, island.name, context.filePath)}}`,\n );\n return `<div ${wrapperAttrs.join(\" \")}>${element}</div>`;\n}\n\n/**\n * Reads and removes the island directives so they never reach the component.\n *\n * The strategy is a build-time decision, so it has to be a literal: resolving\n * it from a document prop would mean the wrapper could not be written until\n * render time, by which point the load strategy has already been read.\n */\nfunction takeMdxIslandHydration(\n payload: MdxIslandPayload,\n name: string,\n filePath: string,\n): MdxIslandHydration | undefined {\n for (const directive of [MDX_ISLAND_DIRECTIVE, MDX_ISLAND_MEDIA_DIRECTIVE]) {\n if (directive in payload.expressions) {\n throw new Error(\n `[ox-content-svelte] \"${directive}\" on <${name}> in ${filePath} has to be a literal, not a document prop: the load strategy is chosen when the page is built.`,\n );\n }\n }\n if (!(MDX_ISLAND_DIRECTIVE in payload.props)) return undefined;\n\n const raw = payload.props[MDX_ISLAND_DIRECTIVE];\n const media = payload.props[MDX_ISLAND_MEDIA_DIRECTIVE];\n delete payload.props[MDX_ISLAND_DIRECTIVE];\n delete payload.props[MDX_ISLAND_MEDIA_DIRECTIVE];\n\n const load = raw === true || raw === \"\" ? \"eager\" : raw;\n if (typeof load !== \"string\" || !MDX_ISLAND_LOAD_STRATEGIES.has(load)) {\n throw new Error(\n `[ox-content-svelte] Unknown island load strategy ${JSON.stringify(raw)} on <${name}> in ${filePath}. Use ${[...MDX_ISLAND_LOAD_STRATEGIES].join(\", \")}.`,\n );\n }\n if (load === \"media\" && typeof media !== \"string\") {\n throw new Error(\n `[ox-content-svelte] <${name} ${MDX_ISLAND_DIRECTIVE}=\"media\"> in ${filePath} needs ${MDX_ISLAND_MEDIA_DIRECTIVE} with the query to wait for.`,\n );\n }\n return { load, media: typeof media === \"string\" ? media : undefined };\n}\n\n/**\n * The same props the component is rendered with, serialised for the client.\n *\n * Built in attribute order so a spread and a named prop resolve the way Svelte\n * resolves them in the template above.\n */\nfunction mdxIslandPropsExpression(\n payload: MdxIslandPayload,\n name: string,\n filePath: string,\n): string {\n const parts: string[] = [];\n\n for (const spread of payload.spreads) {\n const expression = spread.trim().startsWith(\"...\")\n ? spread.trim().slice(3).trim()\n : spread.trim();\n const path = parseDocumentPropPath(expression);\n if (!path) {\n throw new Error(\n `[ox-content-svelte] Unsupported MDX document prop spread \"{${spread}}\" in ${filePath}. Only identifiers and dotted property paths are supported.`,\n );\n }\n parts.push(documentPropResolverExpression(path, expression));\n }\n\n const entries: string[] = [];\n for (const [key, value] of Object.entries(payload.props)) {\n entries.push(`${JSON.stringify(key)}: ${renderSvelteLiteral(value)}`);\n }\n for (const [key, expression] of Object.entries(payload.expressions)) {\n const path = parseDocumentPropPath(expression.trim());\n if (!path) {\n throw new Error(\n `[ox-content-svelte] Unsupported MDX document prop expression \"{${expression}}\" for prop \"${key}\" in ${filePath}. Only identifiers and dotted property paths are supported.`,\n );\n }\n entries.push(\n `${JSON.stringify(key)}: ${documentPropResolverExpression(path, expression.trim())}`,\n );\n }\n if (entries.length > 0) parts.push(`{ ${entries.join(\", \")} }`);\n\n const merged =\n parts.length === 0\n ? \"{}\"\n : parts.length === 1\n ? parts[0]\n : `Object.assign({}, ${parts.join(\", \")})`;\n return `__ox_mdx_island_props(${JSON.stringify(name)}, ${merged})`;\n}\n\nfunction renderMdxIslandAttributes(payload: MdxIslandPayload, filePath: string): string {\n const attrs: string[] = [];\n\n for (const spread of payload.spreads) {\n const expression = spread.trim().startsWith(\"...\")\n ? spread.trim().slice(3).trim()\n : spread.trim();\n const path = parseDocumentPropPath(expression);\n if (!path) {\n throw new Error(\n `[ox-content-svelte] Unsupported MDX document prop spread \"{${spread}}\" in ${filePath}. Only identifiers and dotted property paths are supported.`,\n );\n }\n attrs.push(`{...${documentPropResolverExpression(path, expression)}}`);\n }\n\n for (const [name, value] of Object.entries(payload.props)) {\n assertSvelteAttributeName(name, filePath);\n attrs.push(`${name}={${renderSvelteLiteral(value)}}`);\n }\n\n for (const [name, expression] of Object.entries(payload.expressions)) {\n assertSvelteAttributeName(name, filePath);\n const path = parseDocumentPropPath(expression.trim());\n if (!path) {\n throw new Error(\n `[ox-content-svelte] Unsupported MDX document prop expression \"{${expression}}\" for prop \"${name}\" in ${filePath}. Only identifiers and dotted property paths are supported.`,\n );\n }\n attrs.push(`${name}={${documentPropResolverExpression(path, expression.trim())}}`);\n }\n\n return attrs.length > 0 ? ` ${attrs.join(\" \")}` : \"\";\n}\n\nfunction documentPropResolverExpression(path: readonly string[], expression: string): string {\n return `__ox_mdx_document_prop(__ox_mdx_props, ${JSON.stringify(path)}, ${JSON.stringify(expression)})`;\n}\n\nfunction renderSvelteLiteral(value: unknown): string {\n const literal = JSON.stringify(value);\n return literal === undefined ? \"undefined\" : literal.replaceAll(\"</script\", \"<\\\\/script\");\n}\n\nfunction findMdxIslandRanges(html: string): MdxIslandRange[] {\n const ranges: MdxIslandRange[] = [];\n const openRe = /<(div|span)\\b([^>]*\\bdata-ox-island=\"([^\"]+)\"[^>]*)>/gi;\n let match: RegExpExecArray | null;\n\n while ((match = openRe.exec(html)) !== null) {\n const tag = match[1]!;\n const name = decodeHtmlAttr(match[3] ?? \"\");\n if (!name) continue;\n const openStart = match.index;\n const openEnd = match.index + match[0].length;\n const closeStart = findMatchingClose(html, openEnd, tag);\n const closeEnd = closeStart < html.length ? closeStart + tag.length + 3 : html.length;\n const inner = html.slice(openEnd, closeStart);\n const scriptMatch = inner.match(PAYLOAD_SCRIPT);\n const script = scriptMatch?.[0];\n ranges.push({\n name,\n tag,\n openStart,\n openEnd,\n innerStart: openEnd,\n contentStart: openEnd + (script?.length ?? 0),\n closeStart,\n closeEnd,\n propsAttr: matchAttr(match[2] ?? \"\", \"data-ox-props\"),\n script,\n });\n }\n\n return ranges.sort((left, right) => left.openStart - right.openStart);\n}\n\nfunction findMatchingClose(html: string, from: number, tag: string): number {\n const openNeedle = `<${tag}`;\n const closeNeedle = `</${tag}>`;\n let depth = 1;\n let cursor = from;\n\n while (cursor < html.length) {\n const nextOpen = indexOfTagOpen(html, openNeedle, cursor);\n const nextClose = html.indexOf(closeNeedle, cursor);\n if (nextClose === -1) return html.length;\n if (nextOpen !== -1 && nextOpen < nextClose) {\n depth += 1;\n cursor = nextOpen + openNeedle.length;\n } else {\n depth -= 1;\n if (depth === 0) return nextClose;\n cursor = nextClose + closeNeedle.length;\n }\n }\n\n return html.length;\n}\n\nfunction indexOfTagOpen(html: string, openNeedle: string, from: number): number {\n let cursor = from;\n while (cursor < html.length) {\n const index = html.indexOf(openNeedle, cursor);\n if (index === -1) return -1;\n const next = html[index + openNeedle.length];\n if (next === \" \" || next === \">\" || next === \"\\t\" || next === \"\\n\" || next === \"/\") {\n return index;\n }\n cursor = index + openNeedle.length;\n }\n return -1;\n}\n\nfunction matchAttr(attrs: string, name: string): string | undefined {\n const match = new RegExp(`\\\\b${name}=\"([^\"]*)\"`, \"i\").exec(attrs);\n return match?.[1] === undefined ? undefined : decodeHtmlAttr(match[1]);\n}\n\nfunction readMdxIslandPayload(island: MdxIslandRange): MdxIslandPayload {\n const fromAttr = island.propsAttr ? tryParseJson(island.propsAttr) : undefined;\n const fromScript = island.script\n ? tryParseJson(\n island.script.match(/<script type=\"application\\/json\">([\\s\\S]*?)<\\/script>/i)?.[1] ?? \"\",\n )\n : undefined;\n return normalizeMdxIslandPayload(fromAttr ?? fromScript ?? {});\n}\n\nfunction normalizeMdxIslandPayload(parsed: unknown): MdxIslandPayload {\n if (!parsed || typeof parsed !== \"object\" || Array.isArray(parsed)) {\n return { props: {}, expressions: {}, spreads: [] };\n }\n\n const record = parsed as Record<string, unknown>;\n const keys = Object.keys(record);\n if (keys.length > 0 && keys.every((key) => RUST_PAYLOAD_KEYS.has(key))) {\n return {\n props: toRecord(record.props),\n expressions: toStringRecord(record.expressions),\n spreads: toStringArray(record.spreads),\n };\n }\n\n return { props: record, expressions: {}, spreads: [] };\n}\n\nfunction toRecord(value: unknown): Record<string, unknown> {\n return value && typeof value === \"object\" && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : {};\n}\n\nfunction toStringRecord(value: unknown): Record<string, string> {\n const record = toRecord(value);\n const output: Record<string, string> = {};\n for (const [key, entry] of Object.entries(record)) {\n if (typeof entry === \"string\") {\n output[key] = entry;\n }\n }\n return output;\n}\n\nfunction toStringArray(value: unknown): string[] {\n return Array.isArray(value)\n ? value.filter((entry): entry is string => typeof entry === \"string\")\n : [];\n}\n\nfunction tryParseJson(value: string): unknown {\n try {\n return JSON.parse(value);\n } catch {\n return undefined;\n }\n}\n\nfunction decodeHtmlAttr(value: string): string {\n return value\n .replaceAll(\""\", '\"')\n .replaceAll(\"'\", \"'\")\n .replaceAll(\"<\", \"<\")\n .replaceAll(\">\", \">\")\n .replaceAll(\"&\", \"&\");\n}\n\nfunction assertSvelteComponentName(name: string, filePath: string): void {\n if (!/^[A-Z][A-Za-z0-9_$]*$/.test(name)) {\n throw new Error(\n `[ox-content-svelte] Unsupported MDX component name \"${name}\" in ${filePath} for mdxDocumentProps. Only simple Svelte component identifiers are supported.`,\n );\n }\n}\n\nfunction assertSvelteAttributeName(name: string, filePath: string): void {\n if (!/^[A-Za-z_$][\\w$-]*$/.test(name)) {\n throw new Error(\n `[ox-content-svelte] Unsupported MDX component prop name \"${name}\" in ${filePath}.`,\n );\n }\n}\n\nfunction generateSvelteModule(\n content: string,\n usedComponents: string[],\n _islands: ComponentIsland[] | string[],\n frontmatter: Record<string, unknown>,\n options: ResolvedSvelteOptions & { root?: string },\n id: string,\n localBindings?: ReadonlyMap<string, ResolvedDocumentComponentImport>,\n): string {\n // Rust island payloads include `</script>`; that must not close this SFC block.\n const rawHtmlLiteral = JSON.stringify(content).replaceAll(\"</script\", \"<\\\\/script\");\n\n const imports = renderIslandComponentImports(usedComponents, {\n globalComponents: options.components,\n localBindings,\n documentPath: id,\n root: options.root,\n });\n\n // If no registered islands, generate simpler code without island runtime\n if (usedComponents.length === 0) {\n return `\n<script>\n const frontmatter = ${JSON.stringify(frontmatter)};\n const rawHtml = ${rawHtmlLiteral};\n\n export { frontmatter };\n</script>\n\n<div class=\"ox-content\">\n {@html rawHtml}\n</div>\n\n<style>\n .ox-content {\n line-height: 1.6;\n }\n</style>\n`;\n }\n\n const componentMap = usedComponents.map((name) => ` ${name},`).join(\"\\n\");\n\n return `\n<script>\n import { createRawSnippet, hydrate, mount, onMount, unmount } from 'svelte';\n import { initIslands, readIslandSlotHtml } from '@ox-content/islands';\n ${imports}\n\n const frontmatter = ${JSON.stringify(frontmatter)};\n const rawHtml = ${rawHtmlLiteral};\n const components = {\n${componentMap}\n };\n\n export { frontmatter };\n\n let container;\n\n function createSvelteHydrate() {\n const mounted = [];\n\n return (element, props) => {\n const componentName = element.dataset.oxIsland;\n const Component = components[componentName];\n if (!Component) return;\n\n const islandContent = readIslandSlotHtml(element);\n const componentProps = { ...props };\n if (islandContent) {\n componentProps.children = createRawSnippet(() => ({\n render: () => \\`<div>\\${islandContent}</div>\\`,\n }));\n }\n\n const attach = element.dataset.oxSsr === 'true' ? hydrate : mount;\n const instance = attach(Component, { target: element, props: componentProps });\n mounted.push(instance);\n\n return () => unmount(instance);\n };\n }\n\n onMount(() => {\n if (!container) return;\n const controller = initIslands(createSvelteHydrate(), {\n selector: '.ox-content [data-ox-island]',\n });\n return () => controller.destroy();\n });\n</script>\n\n<div class=\"ox-content\" bind:this={container}>\n {@html rawHtml}\n</div>\n\n<style>\n .ox-content {\n line-height: 1.6;\n }\n</style>\n`;\n}\n","import type { EnvironmentOptions } from \"vite\";\n\nexport function createSvelteMarkdownEnvironment(\n mode: \"ssr\" | \"client\",\n options: { outDir: string },\n): EnvironmentOptions {\n const isSSR = mode === \"ssr\";\n\n return {\n build: {\n outDir: isSSR ? `${options.outDir}/.ox-content/ssr` : `${options.outDir}/.ox-content/client`,\n ssr: isSSR,\n rollupOptions: {\n output: {\n format: \"esm\",\n entryFileNames: isSSR ? \"[name].js\" : \"[name].[hash].js\",\n },\n },\n ...(isSSR && { target: \"node18\", minify: false }),\n },\n resolve: {\n conditions: isSSR ? [\"node\", \"import\"] : [\"browser\", \"import\"],\n },\n optimizeDeps: {\n include: isSSR ? [] : [\"svelte\"],\n exclude: [\"@ox-content/vite-plugin\", \"@ox-content/vite-plugin-svelte\"],\n },\n };\n}\n","/**\n * Resolves the `components` option into a name → path map, expanding glob\n * patterns against the Vite project root.\n */\n\nimport * as fs from \"fs\";\nimport * as path from \"path\";\nimport type { ComponentsMap, ComponentsOption } from \"./types\";\n\nexport async function resolveComponentsGlob(\n componentsOption: ComponentsOption,\n root: string,\n): Promise<ComponentsMap> {\n if (typeof componentsOption === \"object\" && !Array.isArray(componentsOption)) {\n return componentsOption;\n }\n\n const patterns = Array.isArray(componentsOption) ? componentsOption : [componentsOption];\n const result: ComponentsMap = {};\n\n for (const pattern of patterns) {\n for (const file of await globFiles(pattern, root)) {\n const baseName = path.basename(file, path.extname(file));\n const relativePath = \"./\" + path.relative(root, file).replace(/\\\\/g, \"/\");\n result[toPascalCase(baseName)] = relativePath;\n }\n }\n\n return result;\n}\n\nasync function globFiles(pattern: string, root: string): Promise<string[]> {\n const files: string[] = [];\n const normalized = pattern.replace(/\\\\/g, \"/\").replace(/^\\.\\//, \"\");\n\n if (!hasWildcard(normalized)) {\n const fullPath = path.resolve(root, normalized);\n if (fs.existsSync(fullPath)) {\n files.push(fullPath);\n }\n return files;\n }\n\n // Walk from the deepest wildcard-free prefix, then keep only the paths the\n // whole pattern matches. Deriving the base directory alone is not enough:\n // `src/components/**/*.tsx` must not collect the non-component files below\n // `src/components`, and the generated module would fail to import them.\n const baseDir = path.resolve(root, staticPrefix(normalized));\n if (!fs.existsSync(baseDir)) {\n return files;\n }\n\n // Only a pattern whose wildcards are confined to the file name can stay\n // shallow. A wildcard in a directory segment (`src/*/Button.tsx`) puts its\n // matches below `baseDir`, and `**` crosses directory boundaries even inside\n // the last segment, so both need the recursive walk.\n const segments = normalized.split(\"/\");\n const crossesDirectories = normalized.includes(\"**\") || segments.slice(0, -1).some(hasWildcard);\n\n const candidates: string[] = [];\n if (crossesDirectories) {\n await walkDir(baseDir, candidates);\n } else {\n const entries = await fs.promises.readdir(baseDir, { withFileTypes: true });\n for (const entry of entries) {\n if (entry.isFile()) {\n candidates.push(path.join(baseDir, entry.name));\n }\n }\n }\n\n const matcher = globToRegExp(normalized);\n for (const candidate of candidates) {\n if (matcher.test(path.relative(root, candidate).replace(/\\\\/g, \"/\"))) {\n files.push(candidate);\n }\n }\n\n return files;\n}\n\n/** Whether a pattern (or one segment of it) contains a wildcard `globToRegExp` expands. */\nfunction hasWildcard(pattern: string): boolean {\n return pattern.includes(\"*\") || pattern.includes(\"?\");\n}\n\n/** Leading path segments of a pattern that contain no wildcard. */\nfunction staticPrefix(pattern: string): string {\n const segments: string[] = [];\n for (const segment of pattern.split(\"/\")) {\n if (hasWildcard(segment)) break;\n segments.push(segment);\n }\n return segments.join(\"/\");\n}\n\n/**\n * Translates a glob into an anchored `RegExp`: `**` crosses directory\n * boundaries, `*` and `?` stay within one segment.\n */\nfunction globToRegExp(pattern: string): RegExp {\n let source = \"\";\n let index = 0;\n\n while (index < pattern.length) {\n const char = pattern[index];\n if (char === \"*\") {\n if (pattern[index + 1] === \"*\") {\n index += 2;\n if (pattern[index] === \"/\") {\n index += 1;\n source += \"(?:[^/]+/)*\";\n } else {\n source += \".*\";\n }\n continue;\n }\n source += \"[^/]*\";\n } else if (char === \"?\") {\n source += \"[^/]\";\n } else {\n source += char.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n }\n index += 1;\n }\n\n return new RegExp(`^${source}$`);\n}\n\nasync function walkDir(dir: string, files: string[]): Promise<void> {\n const entries = await fs.promises.readdir(dir, { withFileTypes: true });\n\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name);\n\n if (entry.isDirectory()) {\n await walkDir(fullPath, files);\n } else if (entry.isFile()) {\n files.push(fullPath);\n }\n }\n}\n\nfunction toPascalCase(str: string): string {\n return str.replace(/[-_](\\w)/g, (_, c) => c.toUpperCase()).replace(/^\\w/, (c) => c.toUpperCase());\n}\n","import type { SvelteHtmlComponentRenderer } from \"./html-host\";\n\nexport const defaultRenderSvelteHtmlComponent: SvelteHtmlComponentRenderer = async (\n component,\n props,\n slotHtml,\n) => {\n const [{ render }, { createRawSnippet }] = await Promise.all([\n import(\"svelte/server\"),\n import(\"svelte\"),\n ]);\n const componentProps = slotHtml\n ? { ...props, children: createRawSnippet(() => ({ render: () => slotHtml })) }\n : props;\n const rendered = render(component as never, { props: componentProps as never }) as {\n body?: string;\n html?: string;\n };\n return rendered.html ?? rendered.body ?? \"\";\n};\n","import path from \"node:path\";\nimport {\n applyIslandSsrHtml,\n collectMdxIslandNamesFromHtml,\n resolveContentRootPath,\n resolveDocumentComponentImports,\n type DocumentImportDiagnostic,\n type MdxImport,\n} from \"@ox-content/vite-plugin\";\nimport type { ComponentsMap } from \"./types\";\nimport { defaultRenderSvelteHtmlComponent } from \"./html-host-default-renderer\";\n\nconst ISLAND_JSON_SCRIPT = /^\\s*<script type=\"application\\/json\">[\\s\\S]*?<\\/script>/;\n\nexport interface SvelteHtmlHostModule {\n name: string;\n serverModuleId: string;\n exportName: string;\n source: \"document\" | \"components\";\n clientModuleId?: string;\n}\n\nexport interface SvelteHtmlHostClientModule {\n name: string;\n moduleId: string;\n exportName: string;\n}\n\nexport type SvelteHtmlHostDiagnosticCode =\n | DocumentImportDiagnostic[\"code\"]\n | \"missing-component\"\n | \"module-load-failed\"\n | \"missing-export\"\n | \"ssr-failed\";\n\nexport interface SvelteHtmlHostDiagnostic {\n code: SvelteHtmlHostDiagnosticCode;\n message: string;\n documentPath: string;\n component?: string;\n moduleId?: string;\n}\n\nexport type SvelteServerModuleLoader = (moduleId: string) => Promise<unknown>;\ntype SvelteComponentValue = NonNullable<unknown>;\n\nexport type SvelteHtmlComponentRenderer = (\n component: unknown,\n props: Record<string, unknown>,\n slotHtml: string | undefined,\n context: { component: string; moduleId: string; documentPath: string },\n) => string | Promise<string>;\n\nexport type SvelteClientModuleResolver = (\n module: SvelteHtmlHostModule,\n context: { documentPath: string },\n) => string | undefined;\n\nexport interface RenderSvelteHtmlHostInput {\n html: string;\n documentPath: string;\n components?: ComponentsMap;\n imports?: readonly MdxImport[];\n root?: string;\n srcDir?: string;\n contentRoot?: string;\n loadModule: SvelteServerModuleLoader;\n renderComponent?: SvelteHtmlComponentRenderer;\n resolveClientModule?: SvelteClientModuleResolver;\n}\n\nexport interface RenderSvelteHtmlHostResult {\n html: string;\n modules: SvelteHtmlHostModule[];\n clientModules: SvelteHtmlHostClientModule[];\n diagnostics: SvelteHtmlHostDiagnostic[];\n}\n\nexport type SvelteHostHydrateRenderer = (\n component: unknown,\n props: Record<string, unknown>,\n element: HTMLElement,\n slotHtml: string | undefined,\n) => void | (() => void);\n\nexport interface CreateSvelteHtmlHostHydrateInput {\n components: Readonly<Record<string, unknown>> | ReadonlyMap<string, unknown>;\n render: SvelteHostHydrateRenderer;\n}\n\nexport async function renderSvelteHtmlHost(\n input: RenderSvelteHtmlHostInput,\n): Promise<RenderSvelteHtmlHostResult> {\n const diagnostics: SvelteHtmlHostDiagnostic[] = [];\n const modules = resolveHostModules(input, diagnostics);\n const byName = new Map(modules.map((module) => [module.name, module] as const));\n const cache = new Map<string, Promise<unknown>>();\n const renderComponent = input.renderComponent ?? defaultRenderSvelteHtmlComponent;\n\n const html = await applyIslandSsrHtml(\n input.html,\n async (name, props, _filePath, slotHtml) => {\n const module = byName.get(name);\n if (!module) {\n diagnostics.push({\n code: \"missing-component\",\n message: `Svelte island \"${name}\" is not registered for this document.`,\n documentPath: input.documentPath,\n component: name,\n });\n return slotHtml ?? \"\";\n }\n const component = await loadComponent(input, module, cache, diagnostics);\n if (!component) {\n return slotHtml ?? \"\";\n }\n try {\n return await renderComponent(component, props, slotHtml || undefined, {\n component: name,\n moduleId: module.serverModuleId,\n documentPath: input.documentPath,\n });\n } catch (error) {\n diagnostics.push({\n code: \"ssr-failed\",\n message: `Svelte island \"${name}\" failed to render: ${errorMessage(error)}`,\n documentPath: input.documentPath,\n component: name,\n moduleId: module.serverModuleId,\n });\n return slotHtml ?? \"\";\n }\n },\n input.documentPath,\n modules.map((module) => module.name),\n );\n\n return {\n html: markClientModules(html, modules),\n modules,\n clientModules: modules.flatMap((module) =>\n module.clientModuleId\n ? [{ name: module.name, moduleId: module.clientModuleId, exportName: module.exportName }]\n : [],\n ),\n diagnostics,\n };\n}\n\nexport function createSvelteHtmlHostHydrate(\n input: CreateSvelteHtmlHostHydrateInput,\n): (element: HTMLElement, props: Record<string, unknown>) => void | (() => void) {\n return (element, props) => {\n const name = element.dataset.oxIsland;\n if (!name) {\n return undefined;\n }\n const component = componentFromRegistry(input.components, name);\n if (!component) {\n return undefined;\n }\n const slotHtml = readIslandSlotHtml(element);\n element.innerHTML = \"\";\n return input.render(component, props, element, slotHtml || undefined);\n };\n}\n\nfunction resolveHostModules(\n input: RenderSvelteHtmlHostInput,\n diagnostics: SvelteHtmlHostDiagnostic[],\n): SvelteHtmlHostModule[] {\n const names = collectMdxIslandNamesFromHtml(input.html);\n const local = resolveDocumentComponentImports({\n imports: input.imports ?? [],\n documentPath: input.documentPath,\n contentRoot: input.contentRoot ?? resolveContentRootPath(input),\n srcDir: input.srcDir,\n });\n for (const diagnostic of local.diagnostics) {\n diagnostics.push({ ...diagnostic, documentPath: input.documentPath });\n }\n\n const localBindings = new Map(local.bindings.map((binding) => [binding.localName, binding]));\n const modules: SvelteHtmlHostModule[] = [];\n for (const name of names) {\n const localBinding = localBindings.get(name);\n const serverModuleId = localBinding\n ? localBinding.resolvedPath\n : componentPath(input.components ?? {}, name, input.root);\n if (!serverModuleId) {\n diagnostics.push({\n code: \"missing-component\",\n message: `Svelte island \"${name}\" is not registered for this document.`,\n documentPath: input.documentPath,\n component: name,\n });\n continue;\n }\n const module: SvelteHtmlHostModule = {\n name,\n serverModuleId,\n exportName: localBinding?.imported ?? \"default\",\n source: localBinding ? \"document\" : \"components\",\n };\n const clientModuleId = input.resolveClientModule?.(module, {\n documentPath: input.documentPath,\n });\n modules.push(clientModuleId ? { ...module, clientModuleId } : module);\n }\n return modules;\n}\n\nasync function loadComponent(\n input: RenderSvelteHtmlHostInput,\n module: SvelteHtmlHostModule,\n cache: Map<string, Promise<unknown>>,\n diagnostics: SvelteHtmlHostDiagnostic[],\n): Promise<SvelteComponentValue | undefined> {\n let pending = cache.get(module.serverModuleId);\n if (!pending) {\n pending = input.loadModule(module.serverModuleId);\n cache.set(module.serverModuleId, pending);\n }\n let exports: unknown;\n try {\n exports = await pending;\n } catch (error) {\n diagnostics.push({\n code: \"module-load-failed\",\n message: `Svelte island module \"${module.serverModuleId}\" failed to load: ${errorMessage(error)}`,\n documentPath: input.documentPath,\n component: module.name,\n moduleId: module.serverModuleId,\n });\n return undefined;\n }\n const component = exportedValue(exports, module.exportName);\n if (!component) {\n diagnostics.push({\n code: \"missing-export\",\n message: `Svelte island \"${module.name}\" could not find export \"${module.exportName}\".`,\n documentPath: input.documentPath,\n component: module.name,\n moduleId: module.serverModuleId,\n });\n }\n return component == null ? undefined : component;\n}\n\nfunction componentPath(\n components: ComponentsMap,\n name: string,\n root = process.cwd(),\n): string | undefined {\n const specifier = components[name];\n if (!specifier) {\n return undefined;\n }\n return path.resolve(root, specifier.replace(/^\\.\\//, \"\"));\n}\n\nfunction exportedValue(exports: unknown, exportName: string): unknown {\n if (!exports || typeof exports !== \"object\") {\n return undefined;\n }\n return (exports as Record<string, unknown>)[exportName];\n}\n\nfunction componentFromRegistry(\n registry: CreateSvelteHtmlHostHydrateInput[\"components\"],\n name: string,\n): unknown {\n return isReadonlyMap(registry) ? registry.get(name) : registry[name];\n}\n\nfunction isReadonlyMap(\n value: CreateSvelteHtmlHostHydrateInput[\"components\"],\n): value is ReadonlyMap<string, unknown> {\n return typeof (value as ReadonlyMap<string, unknown>).get === \"function\";\n}\n\nfunction readIslandSlotHtml(element: Pick<HTMLElement, \"dataset\" | \"innerHTML\">): string {\n const fromAttr = element.dataset.oxContent;\n if (fromAttr) return fromAttr;\n if (element.dataset.oxSsr === \"true\") return \"\";\n return element.innerHTML.replace(ISLAND_JSON_SCRIPT, \"\");\n}\n\nfunction markClientModules(html: string, modules: readonly SvelteHtmlHostModule[]): string {\n const clientModules = new Map(\n modules.filter((module) => module.clientModuleId).map((module) => [module.name, module]),\n );\n if (clientModules.size === 0) return html;\n\n return html.replace(\n /<(div|span)\\b([^>]*\\bdata-ox-island=\"([^\"]+)\"[^>]*)>/gi,\n (openTag: string, _tag: string, _attrs: string, encodedName: string) => {\n const module = clientModules.get(decodeHtmlAttr(encodedName));\n if (!module?.clientModuleId) return openTag;\n\n const attrs: string[] = [];\n if (!hasAttr(openTag, \"data-ox-module\")) {\n attrs.push(`data-ox-module=\"${escapeDoubleQuotedAttr(module.clientModuleId)}\"`);\n }\n if (!hasAttr(openTag, \"data-ox-export\")) {\n attrs.push(`data-ox-export=\"${escapeDoubleQuotedAttr(module.exportName)}\"`);\n }\n return attrs.length === 0 ? openTag : openTag.replace(/>$/, ` ${attrs.join(\" \")}>`);\n },\n );\n}\n\nfunction escapeDoubleQuotedAttr(value: string): string {\n return value\n .replaceAll(\"&\", \"&\")\n .replaceAll('\"', \""\")\n .replaceAll(\"<\", \"<\")\n .replaceAll(\">\", \">\");\n}\n\nfunction decodeHtmlAttr(value: string): string {\n return value\n .replaceAll(\""\", '\"')\n .replaceAll(\"'\", \"'\")\n .replaceAll(\"<\", \"<\")\n .replaceAll(\">\", \">\")\n .replaceAll(\"&\", \"&\");\n}\n\nfunction hasAttr(openTag: string, name: string): boolean {\n return new RegExp(`\\\\s${name}(?:\\\\s*=|\\\\s|>|$)`, \"i\").test(openTag);\n}\n\nfunction errorMessage(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n","import fsSync from \"node:fs\";\nimport path from \"node:path\";\nimport { stripViteQuery } from \"@ox-content/vite-plugin\";\n\nexport function toSvelteHtmlHostClientModuleId(moduleId: string, root = process.cwd()): string {\n const [pathname, suffix = \"\"] = splitModuleSuffix(moduleId);\n if (isBareSpecifier(pathname) || pathname.startsWith(\"/@fs/\")) {\n return `${pathname}${suffix}`;\n }\n\n const rootPath = path.resolve(root);\n const realRoot = existingRealpath(rootPath) ?? rootPath;\n const absolute = path.isAbsolute(pathname)\n ? path.resolve(pathname)\n : path.resolve(rootPath, pathname);\n const realAbsolute = existingRealpath(absolute);\n const isInsideRealRoot = realAbsolute ? isInsideRoot(realAbsolute, realRoot) : false;\n const isInsideLexicalRoot = isInsideRoot(absolute, rootPath);\n\n if (path.isAbsolute(pathname) && !isInsideRealRoot && !isInsideLexicalRoot) {\n return fsSync.existsSync(pathname)\n ? `/@fs${toPosixPath(pathname)}${suffix}`\n : `${toPosixPath(pathname)}${suffix}`;\n }\n\n const relativeRoot = isInsideRealRoot ? realRoot : rootPath;\n const relativePath = isInsideRealRoot && realAbsolute ? realAbsolute : absolute;\n const relative = path.relative(relativeRoot, relativePath).replace(/\\\\/g, \"/\");\n return `/${relative}${suffix}`;\n}\n\nexport function resolveDocumentPath(documentPath: string, root: string): string {\n return path.isAbsolute(documentPath)\n ? stripViteQuery(documentPath)\n : path.resolve(root, stripViteQuery(documentPath));\n}\n\nexport function resolveWatchFile(file: string, root: string): string {\n return path.isAbsolute(file) ? stripViteQuery(file) : path.resolve(root, stripViteQuery(file));\n}\n\nexport function shouldInvalidate(\n file: string,\n root: string,\n srcDir: string | undefined,\n watchFiles: readonly string[],\n extraWatchFiles: readonly string[] | undefined,\n): boolean {\n const changed = path.resolve(file);\n if (watchFiles.some((watchFile) => changed === watchFile)) return true;\n if (extraWatchFiles?.some((watchFile) => changed === resolveWatchFile(watchFile, root))) {\n return true;\n }\n const contentRoot = path.resolve(root, srcDir ?? \"content\");\n return isInsideRoot(changed, contentRoot);\n}\n\nfunction splitModuleSuffix(moduleId: string): [string, string?] {\n const match = /[?#]/u.exec(moduleId);\n return match ? [moduleId.slice(0, match.index), moduleId.slice(match.index)] : [moduleId];\n}\n\nexport function isBareSpecifier(moduleId: string): boolean {\n return !moduleId.startsWith(\".\") && !moduleId.startsWith(\"/\") && !moduleId.includes(\"\\\\\");\n}\n\nfunction isInsideRoot(file: string, root: string): boolean {\n const relative = path.relative(path.resolve(root), path.resolve(file));\n return relative === \"\" || (!relative.startsWith(\"..\") && !path.isAbsolute(relative));\n}\n\nfunction existingRealpath(file: string): string | undefined {\n try {\n return fsSync.realpathSync.native(file);\n } catch {\n return undefined;\n }\n}\n\nfunction toPosixPath(file: string): string {\n return file.replace(/\\\\/g, \"/\");\n}\n","import { toSvelteHtmlHostClientModuleId } from \"./html-host-registry-paths\";\nimport {\n renderSvelteHtmlHost,\n type RenderSvelteHtmlHostResult,\n type SvelteClientModuleResolver,\n type SvelteHtmlComponentRenderer,\n type SvelteHtmlHostDiagnostic,\n type SvelteServerModuleLoader,\n} from \"./html-host\";\nimport type { MdxImport } from \"@ox-content/vite-plugin\";\nimport type { ComponentsMap } from \"./types\";\n\nexport type SvelteHtmlHostRendererDiagnosticPolicy = \"throw\" | \"collect\";\n\nexport interface CreateSvelteHtmlHostRendererInput {\n root?: string;\n srcDir?: string;\n contentRoot?: string;\n components?: ComponentsMap;\n loadModule: SvelteServerModuleLoader;\n renderComponent?: SvelteHtmlComponentRenderer;\n resolveClientModule?: SvelteClientModuleResolver;\n diagnostics?: SvelteHtmlHostRendererDiagnosticPolicy;\n}\n\nexport interface SvelteHtmlHostRendererContext {\n documentPath: string;\n imports?: readonly MdxImport[];\n root?: string;\n srcDir?: string;\n contentRoot?: string;\n components?: ComponentsMap;\n renderComponent?: SvelteHtmlComponentRenderer;\n resolveClientModule?: SvelteClientModuleResolver;\n}\n\nexport type SvelteHtmlHostRenderer = (\n html: string,\n context: SvelteHtmlHostRendererContext,\n) => Promise<RenderSvelteHtmlHostResult>;\n\nexport class SvelteHtmlHostRenderError extends Error {\n readonly diagnostics: SvelteHtmlHostDiagnostic[];\n\n constructor(diagnostics: readonly SvelteHtmlHostDiagnostic[]) {\n super(formatSvelteHtmlHostDiagnostics(diagnostics));\n this.name = \"SvelteHtmlHostRenderError\";\n this.diagnostics = [...diagnostics];\n }\n}\n\nexport function createSvelteHtmlHostRenderer(\n input: CreateSvelteHtmlHostRendererInput,\n): SvelteHtmlHostRenderer {\n const policy = input.diagnostics ?? \"throw\";\n\n return async (html, context) => {\n const root = context.root ?? input.root;\n const result = await renderSvelteHtmlHost({\n html,\n documentPath: context.documentPath,\n root,\n srcDir: context.srcDir ?? input.srcDir,\n contentRoot: context.contentRoot ?? input.contentRoot,\n imports: context.imports,\n components: context.components ?? input.components,\n loadModule: input.loadModule,\n renderComponent: context.renderComponent ?? input.renderComponent,\n resolveClientModule:\n context.resolveClientModule ??\n input.resolveClientModule ??\n ((module) => toSvelteHtmlHostClientModuleId(module.serverModuleId, root)),\n });\n\n if (policy === \"throw\" && result.diagnostics.length > 0) {\n throw new SvelteHtmlHostRenderError(result.diagnostics);\n }\n\n return result;\n };\n}\n\nfunction formatSvelteHtmlHostDiagnostics(diagnostics: readonly SvelteHtmlHostDiagnostic[]): string {\n if (diagnostics.length === 0) {\n return \"Svelte HTML host rendering failed.\";\n }\n return diagnostics\n .map((diagnostic) => {\n const details = [\n diagnostic.documentPath,\n diagnostic.component && `component ${diagnostic.component}`,\n diagnostic.moduleId && `module ${diagnostic.moduleId}`,\n ].filter(Boolean);\n return `${diagnostic.code}: ${diagnostic.message}${\n details.length > 0 ? ` (${details.join(\", \")})` : \"\"\n }`;\n })\n .join(\"\\n\");\n}\n","import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport {\n buildCollectionManifest,\n customHostOxContentOptions,\n normalizeMarkdownExtensions,\n resolveCascadeOptions,\n resolveCollectionsOptions,\n resolvePermalinksOptions,\n type CollectionEntry,\n type OxContentOptions,\n type ResolvedCollectionsOptions,\n type ResolvedOptions,\n} from \"@ox-content/vite-plugin\";\nimport type {\n SvelteHtmlHostIslandDocument,\n SvelteHtmlHostIslandRegistryContext,\n} from \"./html-host-registry\";\n\ntype MaybePromise<T> = T | Promise<T>;\n\nexport interface SvelteHtmlHostCollectionDocument extends SvelteHtmlHostIslandDocument {\n collection: string;\n entry: CollectionEntry;\n frontmatter: Record<string, unknown>;\n path: string;\n source: string;\n}\n\nexport interface SvelteHtmlHostCollectionDocumentsOptions {\n oxContent?: OxContentOptions;\n collections?: string | readonly string[];\n select?: (\n document: SvelteHtmlHostCollectionDocument,\n context: SvelteHtmlHostIslandRegistryContext,\n ) => MaybePromise<boolean>;\n}\n\nexport function createSvelteHtmlHostCollectionDocuments(\n input: SvelteHtmlHostCollectionDocumentsOptions = {},\n): (\n context: SvelteHtmlHostIslandRegistryContext,\n) => Promise<readonly SvelteHtmlHostCollectionDocument[]> {\n return (context) => resolveSvelteHtmlHostCollectionDocuments(input, context);\n}\n\nexport async function resolveSvelteHtmlHostCollectionDocuments(\n input: SvelteHtmlHostCollectionDocumentsOptions,\n context: SvelteHtmlHostIslandRegistryContext,\n): Promise<readonly SvelteHtmlHostCollectionDocument[]> {\n const oxContent = customHostOxContentOptions(input.oxContent ?? {});\n const options = resolveCollectionManifestOptions(oxContent);\n if (!options.collections.enabled) return [];\n\n const manifest = await buildCollectionManifest(context.root, options);\n const names = resolveCollectionNames(input.collections, options.collections);\n const documents = new Map<string, SvelteHtmlHostCollectionDocument>();\n\n for (const name of names) {\n for (const entry of manifest.collections[name] ?? []) {\n const document = await resolveCollectionDocument(context.root, options.srcDir, name, entry);\n if (!document) continue;\n if (input.select && !(await input.select(document, context))) continue;\n documents.set(document.documentPath, document);\n }\n }\n\n return [...documents.values()];\n}\n\nfunction resolveCollectionManifestOptions(oxContent: OxContentOptions): ResolvedOptions {\n const collections = withoutCollectionInclude(resolveCollectionsOptions(oxContent.collections));\n return {\n srcDir: oxContent.srcDir ?? \"content\",\n outDir: oxContent.outDir ?? \"dist\",\n base: oxContent.base ?? \"/\",\n extensions: normalizeMarkdownExtensions(oxContent.extensions),\n collections,\n permalinks: resolvePermalinksOptions(oxContent.permalinks),\n cascade: resolveCascadeOptions(oxContent.cascade),\n gfm: oxContent.gfm ?? true,\n mdx: oxContent.mdx,\n footnotes: oxContent.footnotes ?? true,\n semanticFootnotes: oxContent.semanticFootnotes ?? false,\n taskLists: oxContent.taskLists ?? true,\n tables: oxContent.tables ?? true,\n strikethrough: oxContent.strikethrough ?? true,\n autolinks: oxContent.autolinks ?? oxContent.gfm ?? true,\n superscript: oxContent.superscript ?? false,\n subscript: oxContent.subscript ?? false,\n smartPunctuation: oxContent.smartPunctuation ?? false,\n autolinkTargetBlank: oxContent.autolinkTargetBlank ?? true,\n linkTargetBlank: oxContent.linkTargetBlank ?? true,\n sourceSpans: oxContent.sourceSpans ?? false,\n frontmatter: oxContent.frontmatter ?? true,\n tocMaxDepth: oxContent.tocMaxDepth ?? 3,\n cjkEmphasis: oxContent.cjkEmphasis ?? false,\n } as ResolvedOptions;\n}\n\nfunction withoutCollectionInclude(\n collections: ResolvedCollectionsOptions,\n): ResolvedCollectionsOptions {\n return {\n enabled: collections.enabled,\n collections: Object.fromEntries(\n Object.entries(collections.collections).map(([name, collection]) => [\n name,\n { ...collection, include: [] },\n ]),\n ),\n };\n}\n\nfunction resolveCollectionNames(\n input: string | readonly string[] | undefined,\n collections: ResolvedCollectionsOptions,\n): string[] {\n const available = Object.keys(collections.collections);\n if (!input) return available;\n const selected = new Set(Array.isArray(input) ? input : [input]);\n return available.filter((name) => selected.has(name));\n}\n\nasync function resolveCollectionDocument(\n root: string,\n srcDir: string,\n collection: string,\n entry: CollectionEntry,\n): Promise<SvelteHtmlHostCollectionDocument | undefined> {\n const candidate = path.resolve(root, srcDir, entry.source);\n let source: string;\n try {\n source = await fs.readFile(candidate, \"utf8\");\n } catch {\n return undefined;\n }\n return {\n collection,\n documentPath: candidate,\n entry,\n frontmatter: entry.frontmatter,\n path: entry.path,\n source,\n };\n}\n","import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport type { ModuleNode, Plugin, ResolvedConfig, ViteDevServer } from \"vite\";\nimport {\n collectMdxIslandNamesFromHtml,\n customHostOxContentOptions,\n discoverDocumentMdxIslands,\n intersectHydratableComponentNames,\n renderMarkdown,\n resolveContentRootPath,\n stripViteQuery,\n type MdxImport,\n type OxContentOptions,\n} from \"@ox-content/vite-plugin\";\nimport { resolveComponentsGlob } from \"./components\";\nimport type { SvelteHtmlHostClientModule, SvelteHtmlHostModule } from \"./html-host\";\nimport {\n isBareSpecifier,\n resolveDocumentPath,\n resolveWatchFile,\n shouldInvalidate,\n toSvelteHtmlHostClientModuleId,\n} from \"./html-host-registry-paths\";\nimport {\n resolveSvelteHtmlHostCollectionDocuments,\n type SvelteHtmlHostCollectionDocumentsOptions,\n} from \"./html-host-collection-documents\";\nimport type { ComponentsMap, ComponentsOption } from \"./types\";\nexport { toSvelteHtmlHostClientModuleId } from \"./html-host-registry-paths\";\n\nexport const SVELTE_HTML_HOST_MODULES_VIRTUAL_ID = \"virtual:ox-content-svelte/html-host/modules\";\n\ntype MaybePromise<T> = T | Promise<T>;\n\nexport interface SvelteHtmlHostIslandDocument {\n documentPath: string;\n source?: string;\n html?: string;\n imports?: readonly MdxImport[];\n components?: ComponentsMap;\n dependencies?: readonly string[];\n}\n\nexport interface SvelteHtmlHostIslandEntry {\n moduleId: string;\n name?: string;\n exportName?: string;\n documentPath?: string;\n}\n\nexport interface SvelteHtmlHostIslandRegistryContext {\n root: string;\n mode: string;\n command: \"build\" | \"serve\";\n}\n\nexport interface CreateSvelteHtmlHostIslandRegistryInput {\n documents?:\n | readonly SvelteHtmlHostIslandDocument[]\n | ((\n context: SvelteHtmlHostIslandRegistryContext,\n ) => MaybePromise<readonly SvelteHtmlHostIslandDocument[]>);\n collectionDocuments?: false | SvelteHtmlHostCollectionDocumentsOptions;\n entries?:\n | readonly SvelteHtmlHostIslandEntry[]\n | ((\n context: SvelteHtmlHostIslandRegistryContext,\n ) => MaybePromise<readonly SvelteHtmlHostIslandEntry[]>);\n components?: ComponentsOption;\n oxContent?: OxContentOptions;\n root?: string;\n watch?: readonly string[];\n virtualModuleId?: string;\n}\n\nexport interface ResolvedSvelteHtmlHostIslandRegistry {\n modules: SvelteHtmlHostClientModule[];\n watchFiles: string[];\n}\n\nexport interface SvelteHtmlHostIslandRegistry {\n plugin: Plugin;\n virtualModuleId: string;\n resolve(): Promise<ResolvedSvelteHtmlHostIslandRegistry>;\n resolveClientModule(module: Pick<SvelteHtmlHostModule, \"serverModuleId\">): string;\n}\n\nexport function createSvelteHtmlHostIslandRegistry(\n input: CreateSvelteHtmlHostIslandRegistryInput = {},\n): SvelteHtmlHostIslandRegistry {\n const virtualModuleId = input.virtualModuleId ?? SVELTE_HTML_HOST_MODULES_VIRTUAL_ID;\n const resolvedVirtualModuleId = `\\0${virtualModuleId}`;\n let config: ResolvedConfig | undefined;\n let command: \"build\" | \"serve\" = \"build\";\n let components: ComponentsMap | undefined;\n let cache: Promise<ResolvedSvelteHtmlHostIslandRegistry> | undefined;\n let resolved: ResolvedSvelteHtmlHostIslandRegistry = { modules: [], watchFiles: [] };\n\n const context = (): SvelteHtmlHostIslandRegistryContext => ({\n root: config?.root ?? input.root ?? process.cwd(),\n mode: config?.mode ?? \"production\",\n command,\n });\n\n const resolve = async () => {\n cache ??= resolveSvelteHtmlHostIslandRegistry(input, context(), components).then((next) => {\n resolved = next;\n return next;\n });\n return cache;\n };\n\n const invalidate = () => {\n cache = undefined;\n };\n\n const plugin: Plugin = {\n name: \"ox-content:svelte-html-host-island-registry\",\n\n config(_config, env) {\n command = env.command;\n },\n\n async configResolved(resolvedConfig) {\n config = resolvedConfig;\n components = input.components\n ? await resolveComponentsGlob(input.components, resolvedConfig.root)\n : {};\n invalidate();\n },\n\n buildStart() {\n invalidate();\n },\n\n resolveId(id) {\n return id === virtualModuleId ? resolvedVirtualModuleId : null;\n },\n\n async load(id) {\n if (id !== resolvedVirtualModuleId) return null;\n return renderModulesVirtualModule(await resolve());\n },\n\n handleHotUpdate(ctx) {\n if (\n !shouldInvalidate(\n ctx.file,\n context().root,\n input.oxContent?.srcDir,\n resolved.watchFiles,\n input.watch,\n )\n ) {\n return undefined;\n }\n invalidate();\n invalidateVirtualModule(ctx.server, resolvedVirtualModuleId);\n ctx.server.ws.send({ type: \"full-reload\" });\n return [];\n },\n };\n\n return {\n plugin,\n virtualModuleId,\n resolve,\n resolveClientModule(module) {\n return toSvelteHtmlHostClientModuleId(module.serverModuleId, context().root);\n },\n };\n}\n\nexport async function resolveSvelteHtmlHostIslandRegistry(\n input: CreateSvelteHtmlHostIslandRegistryInput,\n context: SvelteHtmlHostIslandRegistryContext,\n resolvedComponents?: ComponentsMap,\n): Promise<ResolvedSvelteHtmlHostIslandRegistry> {\n const components =\n resolvedComponents ??\n (input.components ? await resolveComponentsGlob(input.components, context.root) : {});\n const documents = [\n ...((await resolveMaybe(input.documents, context)) ?? []),\n ...((await resolveInputCollectionDocuments(input, context)) ?? []),\n ];\n const entries = await resolveMaybe(input.entries, context);\n const modules = new Map<string, SvelteHtmlHostClientModule>();\n const watchFiles = new Set<string>();\n\n for (const file of input.watch ?? []) {\n watchFiles.add(resolveWatchFile(file, context.root));\n }\n\n for (const entry of entries ?? []) {\n addModule(modules, {\n name:\n entry.name ?? path.basename(stripViteQuery(entry.moduleId), path.extname(entry.moduleId)),\n moduleId: toSvelteHtmlHostClientModuleId(entry.moduleId, context.root),\n exportName: entry.exportName ?? \"default\",\n });\n if (entry.documentPath) watchFiles.add(resolveWatchFile(entry.documentPath, context.root));\n }\n\n const oxContent = customHostOxContentOptions({ ...input.oxContent, embeds: false });\n const srcDir = oxContent.srcDir ?? \"content\";\n const contentRoot = resolveContentRootPath({ root: context.root, srcDir });\n for (const document of documents) {\n const documentPath = resolveDocumentPath(document.documentPath, context.root);\n watchFiles.add(documentPath);\n for (const dependency of document.dependencies ?? []) {\n watchFiles.add(resolveWatchFile(dependency, context.root));\n }\n\n const materialized = await materializeDocument(document, documentPath, oxContent);\n if (!materialized) continue;\n\n const documentComponents = document.components ?? components;\n const discovered = await discoverDocumentMdxIslands({\n source: materialized.source,\n html: materialized.html,\n components: documentComponents,\n imports: materialized.imports,\n documentPath,\n contentRoot,\n srcDir,\n root: context.root,\n });\n const usedComponents = new Set(discovered.usedComponents);\n if (materialized.html) {\n for (const name of intersectHydratableComponentNames(\n collectMdxIslandNamesFromHtml(materialized.html),\n documentComponents,\n discovered.localBindings.keys(),\n )) {\n usedComponents.add(name);\n }\n }\n\n for (const name of usedComponents) {\n const local = discovered.localBindings.get(name);\n const serverModuleId = local\n ? local.resolvedPath\n : resolveComponentPath(documentComponents, name, context.root);\n if (!serverModuleId) continue;\n addModule(modules, {\n name,\n moduleId: toSvelteHtmlHostClientModuleId(serverModuleId, context.root),\n exportName: local?.imported ?? \"default\",\n });\n }\n }\n\n return {\n modules: [...modules.values()].sort((a, b) =>\n `${a.moduleId}\\0${a.exportName}\\0${a.name}`.localeCompare(\n `${b.moduleId}\\0${b.exportName}\\0${b.name}`,\n ),\n ),\n watchFiles: [...watchFiles],\n };\n}\n\nfunction resolveInputCollectionDocuments(\n input: CreateSvelteHtmlHostIslandRegistryInput,\n context: SvelteHtmlHostIslandRegistryContext,\n): Promise<readonly SvelteHtmlHostIslandDocument[]> | undefined {\n if (!input.collectionDocuments) return undefined;\n const collectionInput =\n input.collectionDocuments.oxContent === undefined\n ? { ...input.collectionDocuments, oxContent: input.oxContent }\n : input.collectionDocuments;\n return resolveSvelteHtmlHostCollectionDocuments(collectionInput, context);\n}\n\nfunction renderModulesVirtualModule(registry: ResolvedSvelteHtmlHostIslandRegistry): string {\n const moduleIds = [...new Set(registry.modules.map((module) => module.moduleId))].sort();\n return [\n \"export const modules = {\",\n ...moduleIds.map(\n (moduleId) => ` ${JSON.stringify(moduleId)}: () => import(${JSON.stringify(moduleId)}),`,\n ),\n \"};\",\n `export const clientModules = ${JSON.stringify(registry.modules, null, 2)};`,\n \"export default modules;\",\n \"\",\n ].join(\"\\n\");\n}\n\nasync function materializeDocument(\n document: SvelteHtmlHostIslandDocument,\n documentPath: string,\n oxContent: OxContentOptions,\n): Promise<{ source: string; html?: string; imports: readonly MdxImport[] } | undefined> {\n const source = document.source ?? (await readOptional(documentPath));\n if (source === undefined && document.html === undefined) return undefined;\n if (document.imports && document.html !== undefined) {\n return { source: source ?? \"\", html: document.html, imports: document.imports };\n }\n if (source === undefined) {\n return { source: \"\", html: document.html, imports: document.imports ?? [] };\n }\n const rendered = await renderMarkdown(source, documentPath, oxContent);\n return {\n source,\n html: document.html ?? rendered.html,\n imports: document.imports ?? rendered.imports,\n };\n}\n\nasync function readOptional(file: string): Promise<string | undefined> {\n try {\n return await fs.readFile(file, \"utf8\");\n } catch {\n return undefined;\n }\n}\n\nfunction addModule(\n modules: Map<string, SvelteHtmlHostClientModule>,\n module: SvelteHtmlHostClientModule,\n) {\n modules.set(`${module.moduleId}\\0${module.exportName}\\0${module.name}`, module);\n}\n\nfunction resolveMaybe<T>(\n value:\n | readonly T[]\n | ((context: SvelteHtmlHostIslandRegistryContext) => MaybePromise<readonly T[]>)\n | undefined,\n context: SvelteHtmlHostIslandRegistryContext,\n): MaybePromise<readonly T[] | undefined> {\n return typeof value === \"function\" ? value(context) : value;\n}\n\nfunction resolveComponentPath(\n components: ComponentsMap,\n name: string,\n root: string,\n): string | undefined {\n const specifier = components[name];\n if (!specifier) return undefined;\n if (isBareSpecifier(specifier) || specifier.startsWith(\"/@fs/\")) return specifier;\n if (specifier.startsWith(\"/\") && !path.isAbsolute(specifier)) return specifier;\n return path.isAbsolute(specifier) ? specifier : path.resolve(root, specifier);\n}\n\nfunction invalidateVirtualModule(server: ViteDevServer, resolvedVirtualModuleId: string): void {\n const mod = server.moduleGraph.getModuleById(resolvedVirtualModuleId);\n if (mod) server.moduleGraph.invalidateModule(mod as ModuleNode);\n}\n","/**\n * Vite Plugin for Ox Content Svelte Integration\n *\n * Uses Vite's Environment API to enable embedding Svelte components in Markdown.\n */\n\nimport type { Plugin, PluginOption, ResolvedConfig } from \"vite\";\nimport { oxContent } from \"@ox-content/vite-plugin\";\nimport { transformMarkdownWithSvelte } from \"./transform\";\nimport { createSvelteMarkdownEnvironment } from \"./environment\";\nimport { resolveComponentsGlob } from \"./components\";\nimport type {\n SvelteIntegrationOptions,\n ResolvedSvelteOptions,\n BuiltinEmbedOptions,\n SvelteCompilerWarning,\n} from \"./types\";\n\nconst DEFAULT_MARKDOWN_EXTENSIONS = [\".md\", \".markdown\", \".mdx\"] as const;\n\nfunction normalizeMarkdownExtensions(extensions?: readonly string[]): string[] {\n const values = extensions?.length ? extensions : DEFAULT_MARKDOWN_EXTENSIONS;\n return Array.from(\n new Map(\n values.map((extension) => {\n const value = extension.startsWith(\".\") ? extension : `.${extension}`;\n return [value.toLowerCase(), value] as const;\n }),\n ).values(),\n );\n}\n\nfunction isMarkdownFilePath(filePath: string, extensions: readonly string[]): boolean {\n const pathname = filePath.split(\"?\")[0].split(\"#\")[0].toLowerCase();\n return extensions.some((extension) => pathname.endsWith(extension.toLowerCase()));\n}\n\nfunction resolveBuiltinEmbedOptions(\n options: BuiltinEmbedOptions | false | undefined,\n): ResolvedSvelteOptions[\"embeds\"] {\n if (options === false) return { github: false, openGraph: false };\n return {\n github: resolveSingleEmbedOptions(options?.github),\n openGraph: resolveSingleEmbedOptions(options?.openGraph),\n };\n}\n\nfunction resolveSingleEmbedOptions<T extends object>(options: boolean | T | undefined): T | false {\n if (options === false) return false;\n if (options === true || options === undefined) return {} as T;\n return options;\n}\n\nexport type {\n SvelteIntegrationOptions,\n ResolvedSvelteOptions,\n ComponentsOption,\n ComponentsMap,\n BuiltinEmbedOptions,\n MdxDocumentPropsOption,\n GitHubEmbedOptions,\n OpenGraphEmbedOptions,\n ResolvedBuiltinEmbedOptions,\n SvelteTransformResult,\n SvelteCompilerOption,\n SvelteCompilerWarning,\n SvelteCompilerOptions,\n SvelteCompilerResult,\n SvelteCompileFunction,\n ComponentIsland,\n} from \"./types\";\nexport type {\n MdxImport,\n MdxImportSpecifier,\n MdxImportSpecifierKind,\n} from \"@ox-content/vite-plugin\";\nexport {\n createSvelteHtmlHostHydrate,\n renderSvelteHtmlHost,\n type CreateSvelteHtmlHostHydrateInput,\n type RenderSvelteHtmlHostInput,\n type RenderSvelteHtmlHostResult,\n type SvelteClientModuleResolver,\n type SvelteHostHydrateRenderer,\n type SvelteHtmlComponentRenderer,\n type SvelteHtmlHostClientModule,\n type SvelteHtmlHostDiagnostic,\n type SvelteHtmlHostDiagnosticCode,\n type SvelteHtmlHostModule,\n type SvelteServerModuleLoader,\n} from \"./html-host\";\nexport {\n SvelteHtmlHostRenderError,\n createSvelteHtmlHostRenderer,\n type CreateSvelteHtmlHostRendererInput,\n type SvelteHtmlHostRenderer,\n type SvelteHtmlHostRendererContext,\n type SvelteHtmlHostRendererDiagnosticPolicy,\n} from \"./html-host-renderer\";\nexport {\n createSvelteHtmlHostDomRenderer,\n createSvelteHtmlHostLazyHydrate,\n initSvelteHtmlHost,\n loadSvelteHtmlHostDomRuntime,\n readSvelteHtmlHostSlot,\n type CreateSvelteHtmlHostLazyHydrateInput,\n type InitSvelteHtmlHostInput,\n type SvelteHtmlHostClientComponentValue,\n type SvelteHtmlHostClientContext,\n type SvelteHtmlHostClientDiagnosticCode,\n type SvelteHtmlHostClientError,\n type SvelteHtmlHostClientModuleLoader,\n type SvelteHtmlHostClientModules,\n type SvelteHtmlHostClientModuleValue,\n type SvelteHtmlHostClientRenderer,\n type SvelteHtmlHostClientRuntimeLoader,\n type SvelteHtmlHostDomMode,\n type SvelteHtmlHostDomRenderer,\n type SvelteHtmlHostDomRendererInput,\n type SvelteHtmlHostDomRuntime,\n type SvelteHtmlHostExportNameResolver,\n type SvelteHtmlHostInitIslands,\n type SvelteHtmlHostModuleIdResolver,\n} from \"./html-host-client\";\nexport {\n SVELTE_HTML_HOST_MODULES_VIRTUAL_ID,\n createSvelteHtmlHostIslandRegistry,\n resolveSvelteHtmlHostIslandRegistry,\n toSvelteHtmlHostClientModuleId,\n type CreateSvelteHtmlHostIslandRegistryInput,\n type ResolvedSvelteHtmlHostIslandRegistry,\n type SvelteHtmlHostIslandDocument,\n type SvelteHtmlHostIslandEntry,\n type SvelteHtmlHostIslandRegistry,\n type SvelteHtmlHostIslandRegistryContext,\n} from \"./html-host-registry\";\nexport {\n createSvelteHtmlHostCollectionDocuments,\n resolveSvelteHtmlHostCollectionDocuments,\n type SvelteHtmlHostCollectionDocument,\n type SvelteHtmlHostCollectionDocumentsOptions,\n} from \"./html-host-collection-documents\";\n\n/**\n * Creates the Ox Content Svelte integration plugin.\n *\n * Forwards core options such as `ssg`, `redirects`, `feeds`, and `siteMaps`.\n * The Svelte Markdown transform and environments replace the generic core\n * transform/`markdown` environment; other build plugins are kept.\n *\n * @example\n * ```ts\n * // vite.config.ts\n * import { defineConfig } from 'vite';\n * import { svelte } from '@sveltejs/vite-plugin-svelte';\n * import { oxContentSvelte } from 'vite-plugin-ox-content-svelte';\n *\n * export default defineConfig({\n * plugins: [\n * svelte(),\n * oxContentSvelte({\n * srcDir: 'docs',\n * components: {\n * Counter: './src/components/Counter.svelte',\n * },\n * }),\n * ],\n * });\n * ```\n */\nexport function oxContentSvelte(options: SvelteIntegrationOptions = {}): PluginOption[] {\n const resolved = resolveSvelteOptions(options);\n let componentMap = new Map<string, string>();\n let config: ResolvedConfig;\n\n if (typeof options.components === \"object\" && !Array.isArray(options.components)) {\n componentMap = new Map(Object.entries(options.components));\n }\n\n const svelteTransformPlugin: Plugin = {\n name: \"ox-content:svelte-transform\",\n enforce: \"pre\",\n\n async configResolved(resolvedConfig) {\n config = resolvedConfig;\n\n const componentsOption = options.components;\n if (componentsOption) {\n const resolvedComponents = await resolveComponentsGlob(componentsOption, config.root);\n componentMap = new Map(Object.entries(resolvedComponents));\n }\n },\n\n async transform(code, id, transformOptions) {\n if (!isMarkdownFilePath(id, resolved.extensions)) {\n return null;\n }\n\n const result = await transformMarkdownWithSvelte(code, id, {\n ...resolved,\n components: Object.fromEntries(componentMap),\n root: config.root,\n renderIsland: options.renderIsland,\n ssr: transformOptions?.ssr,\n });\n\n for (const warning of result.warnings) {\n this.warn(formatSvelteCompilerWarning(warning));\n }\n\n return {\n code: result.code,\n map: result.map as never,\n };\n },\n };\n\n const svelteEnvironmentPlugin: Plugin = {\n name: \"ox-content:svelte-environment\",\n\n config() {\n return {\n environments: {\n oxcontent_ssr: createSvelteMarkdownEnvironment(\"ssr\", resolved),\n oxcontent_client: createSvelteMarkdownEnvironment(\"client\", resolved),\n },\n };\n },\n\n resolveId(id) {\n if (id === \"virtual:ox-content-svelte/runtime\") {\n return \"\\0virtual:ox-content-svelte/runtime\";\n }\n if (id === \"virtual:ox-content-svelte/components\") {\n return \"\\0virtual:ox-content-svelte/components\";\n }\n return null;\n },\n\n load(id) {\n if (id === \"\\0virtual:ox-content-svelte/runtime\") {\n return generateRuntimeModule();\n }\n if (id === \"\\0virtual:ox-content-svelte/components\") {\n return generateComponentsModule(componentMap);\n }\n return null;\n },\n\n applyToEnvironment(environment) {\n return [\"oxcontent_ssr\", \"oxcontent_client\", \"client\", \"ssr\"].includes(environment.name);\n },\n };\n\n const svelteHmrPlugin: Plugin = {\n name: \"ox-content:svelte-hmr\",\n apply: \"serve\",\n\n handleHotUpdate({ file, server, modules }) {\n const isComponent = Array.from(componentMap.values()).some((path) =>\n file.endsWith(path.replace(/^\\.\\//, \"\")),\n );\n\n if (isComponent) {\n const mdModules = Array.from(server.moduleGraph.idToModuleMap.values()).filter(\n (mod) => mod.file && isMarkdownFilePath(mod.file, resolved.extensions),\n );\n\n if (mdModules.length > 0) {\n server.ws.send({\n type: \"custom\",\n event: \"ox-content:svelte-update\",\n data: { file },\n });\n return [...modules, ...mdModules];\n }\n }\n\n return modules;\n },\n };\n\n const replacedCorePluginNames = new Set([\"ox-content\", \"ox-content:environment\"]);\n const corePlugins = (\n oxContent(options).flatMap((plugin) => (Array.isArray(plugin) ? plugin : [plugin])) as Plugin[]\n ).filter((plugin) => !replacedCorePluginNames.has(plugin.name));\n\n return [svelteTransformPlugin, svelteEnvironmentPlugin, svelteHmrPlugin, ...corePlugins];\n}\n\nfunction resolveSvelteOptions(\n options: SvelteIntegrationOptions,\n): Omit<ResolvedSvelteOptions, \"components\"> {\n return {\n srcDir: options.srcDir ?? \"docs\",\n outDir: options.outDir ?? \"dist\",\n base: options.base ?? \"/\",\n extensions: normalizeMarkdownExtensions(options.extensions),\n gfm: options.gfm ?? true,\n autolinks: options.autolinks ?? options.gfm ?? true,\n frontmatter: options.frontmatter ?? true,\n toc: options.toc ?? true,\n tocMaxDepth: options.tocMaxDepth ?? 3,\n codeAnnotations: resolveCodeAnnotationsOptions(options.codeAnnotations),\n runes: options.runes ?? true,\n compiler: options.compiler,\n embeds: resolveBuiltinEmbedOptions(options.embeds),\n mdx: options.mdx,\n mdxDocumentProps: options.mdxDocumentProps ?? false,\n };\n}\n\nfunction formatSvelteCompilerWarning(warning: SvelteCompilerWarning): string {\n const code = warning.code ? `[${warning.code}] ` : \"\";\n const message = `${code}${warning.message}`;\n return warning.frame ? `${message}\\n${warning.frame}` : message;\n}\n\nfunction resolveCodeAnnotationsOptions(\n options: SvelteIntegrationOptions[\"codeAnnotations\"],\n): ResolvedSvelteOptions[\"codeAnnotations\"] {\n if (!options) {\n return {\n enabled: false,\n metaKey: \"annotate\",\n };\n }\n\n if (options === true) {\n return {\n enabled: true,\n metaKey: \"annotate\",\n };\n }\n\n return {\n enabled: true,\n metaKey: options.metaKey ?? \"annotate\",\n };\n}\n\nfunction generateRuntimeModule(): string {\n return `\n// Svelte 5 runtime for ox-content\nexport { mount, unmount } from 'svelte';\n`;\n}\n\nfunction generateComponentsModule(componentMap: Map<string, string>): string {\n const imports: string[] = [];\n const exports: string[] = [];\n\n componentMap.forEach((path, name) => {\n imports.push(`import ${name} from '${path}';`);\n exports.push(` ${name},`);\n });\n\n return `\n${imports.join(\"\\n\")}\n\nexport const components = {\n${exports.join(\"\\n\")}\n};\n\nexport default components;\n`;\n}\n\nexport { oxContent, renderHead } from \"@ox-content/vite-plugin\";\nexport type { HeadInput, RenderedHead } from \"@ox-content/vite-plugin\";\n"],"mappings":";;;;;;;;;AAqBA,MAAM,kBAAkB;AACxB,MAAM,aAAa;AAEnB,MAAM,uBAAuB;AAC7B,MAAM,uBAAuB;AAC7B,MAAM,8BAA8B;AACpC,MAAM,8BAA8B;AACpC,MAAM,iBAAiB;AACvB,MAAM,oCAAoB,IAAI,IAAI;CAAC;CAAS;CAAe;AAAS,CAAC;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AI,EAAE;;;;;AAKrB"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["baseTransformMarkdown","compileWithDefaultSvelte","toHtmlHostClientModuleId","oxContent"],"sources":["../src/transform.ts","../src/environment.ts","../src/components.ts","../src/html-host-default-renderer.ts","../src/html-host.ts","../src/html-host-renderer.ts","../src/html-host-registry.ts","../src/html-host-collection-documents.ts","../src/index.ts"],"sourcesContent":["import {\n applyIslandSsrHtml,\n discoverDocumentMdxIslands,\n renderIslandComponentImports,\n resolveContentRootPath,\n resolveMdxForFilePath,\n transformMarkdown as baseTransformMarkdown,\n type ResolvedDocumentComponentImport,\n} from \"@ox-content/vite-plugin\";\nimport { compile as compileWithDefaultSvelte } from \"svelte/compiler\";\nimport type {\n ResolvedSvelteOptions,\n SvelteTransformResult,\n ComponentIsland,\n ComponentsMap,\n SvelteCompileFunction,\n SvelteCompilerOption,\n SvelteCompilerResult,\n SvelteCompilerWarning,\n} from \"./types\";\n\nconst COMPONENT_REGEX = /<([A-Z][a-zA-Z0-9]*)\\s*([^>]*?)\\s*(?:\\/>|>([\\s\\S]*?)<\\/\\1>)/g;\nconst PROP_REGEX = /([a-zA-Z0-9-]+)(?:=(?:\"([^\"]*)\"|'([^']*)'|{([^}]*)}|\\[([^\\]]*)\\]))?/g;\n\nconst ISLAND_MARKER_PREFIX = \"OXCONTENT-ISLAND-\";\nconst ISLAND_MARKER_SUFFIX = \"-PLACEHOLDER\";\nconst DOCUMENT_PROP_MARKER_PREFIX = \"OXCONTENT-DOCUMENT-PROP-\";\nconst DOCUMENT_PROP_MARKER_SUFFIX = \"-PLACEHOLDER\";\nconst PAYLOAD_SCRIPT = /^\\s*<script type=\"application\\/json\">[\\s\\S]*?<\\/script>/i;\nconst RUST_PAYLOAD_KEYS = new Set([\"props\", \"expressions\", \"spreads\"]);\n\ninterface Range {\n start: number;\n end: number;\n}\n\nexport async function transformMarkdownWithSvelte(\n code: string,\n id: string,\n options: ResolvedSvelteOptions,\n): Promise<SvelteTransformResult> {\n const components: ComponentsMap = options.components;\n const { content: markdownContent, frontmatter } = extractFrontmatter(code);\n const mdx = resolveMdxForFilePath(id, options.mdx);\n\n const baseOptions = {\n srcDir: options.srcDir,\n outDir: options.outDir,\n base: options.base,\n extensions: options.extensions,\n mdx,\n ssg: {\n enabled: false,\n extension: \".html\",\n clean: false,\n bare: false,\n generateOgImage: false,\n lastUpdated: false,\n pagination: false,\n breadcrumbs: false,\n jsonLd: false,\n readerChrome: false,\n localeSwitcher: false,\n a11y: false,\n pageChrome: false,\n },\n gfm: options.gfm,\n frontmatter: false,\n toc: options.toc,\n tocMaxDepth: options.tocMaxDepth,\n codeAnnotations: options.codeAnnotations,\n footnotes: true,\n tables: true,\n taskLists: true,\n strikethrough: true,\n autolinks: options.autolinks,\n highlight: false,\n mermaid: false,\n ogImage: false,\n ogImageOptions: {\n vuePlugin: \"vitejs\",\n width: 1200,\n height: 630,\n cache: true,\n concurrency: 1,\n },\n transformers: [],\n docs: false,\n ogViewer: false,\n search: {\n enabled: false,\n limit: 10,\n prefix: true,\n placeholder: \"Search...\",\n hotkey: \"k\",\n },\n embeds: options.embeds,\n i18n: false,\n } as unknown as Parameters<typeof baseTransformMarkdown>[2] & {\n codeAnnotations?: ResolvedSvelteOptions[\"codeAnnotations\"];\n };\n\n if (mdx) {\n const documentExpressions = options.mdxDocumentProps\n ? prepareMdxDocumentExpressions(markdownContent, id)\n : { content: markdownContent, expressions: [] };\n const transformed = await baseTransformMarkdown(documentExpressions.content, id, baseOptions);\n const discovered = await discoverDocumentMdxIslands({\n source: markdownContent,\n html: transformed.html,\n components,\n imports: transformed.imports,\n documentPath: id,\n contentRoot: resolveContentRootPath({ srcDir: options.srcDir, root: options.root }),\n srcDir: options.srcDir,\n });\n if (options.mdxDocumentProps) {\n return compileSvelteResult(\n generateMdxDocumentPropsSvelteModule(\n transformed.html,\n discovered.usedComponents,\n frontmatter,\n options,\n id,\n discovered.localBindings,\n documentExpressions.expressions,\n ),\n id,\n discovered.usedComponents,\n frontmatter,\n options,\n );\n }\n const html = options.renderIsland\n ? await applyIslandSsrHtml(\n transformed.html,\n options.renderIsland,\n id,\n discovered.usedComponents,\n )\n : transformed.html;\n return compileSvelteResult(\n generateSvelteModule(\n html,\n discovered.usedComponents,\n discovered.usedComponents,\n frontmatter,\n options,\n id,\n discovered.localBindings,\n ),\n id,\n discovered.usedComponents,\n frontmatter,\n options,\n );\n }\n\n const usedComponents: string[] = [];\n const islands: ComponentIsland[] = [];\n let islandIndex = 0;\n\n const fenceRanges = collectFenceRanges(markdownContent);\n let processedContent = \"\";\n let lastIndex = 0;\n let match: RegExpExecArray | null;\n\n COMPONENT_REGEX.lastIndex = 0;\n while ((match = COMPONENT_REGEX.exec(markdownContent)) !== null) {\n const [fullMatch, componentName, propsString, rawIslandContent] = match;\n const matchStart = match.index;\n const matchEnd = matchStart + fullMatch.length;\n\n if (\n !Object.prototype.hasOwnProperty.call(components, componentName) ||\n isInRanges(matchStart, matchEnd, fenceRanges)\n ) {\n processedContent += markdownContent.slice(lastIndex, matchEnd);\n lastIndex = matchEnd;\n continue;\n }\n\n if (!usedComponents.includes(componentName)) {\n usedComponents.push(componentName);\n }\n\n const props = parseProps(propsString);\n const islandId = `ox-island-${islandIndex++}`;\n const islandContent =\n typeof rawIslandContent === \"string\" ? rawIslandContent.trim() : undefined;\n\n islands.push({\n name: componentName,\n props,\n position: matchStart,\n id: islandId,\n content: islandContent,\n });\n\n processedContent += markdownContent.slice(lastIndex, matchStart) + createIslandMarker(islandId);\n lastIndex = matchEnd;\n }\n processedContent += markdownContent.slice(lastIndex);\n\n const transformed = await baseTransformMarkdown(processedContent, id, baseOptions);\n const htmlWithIslands = injectIslandMarkers(transformed.html, islands);\n return compileSvelteResult(\n generateSvelteModule(htmlWithIslands, usedComponents, islands, frontmatter, options, id),\n id,\n usedComponents,\n frontmatter,\n options,\n );\n}\n\nasync function compileSvelteResult(\n svelteCode: string,\n id: string,\n usedComponents: string[],\n frontmatter: Record<string, unknown>,\n options: ResolvedSvelteOptions,\n): Promise<SvelteTransformResult> {\n const compiler = resolveSvelteCompiler(options.compiler);\n const compiled = normalizeSvelteCompilerResult(\n await compiler(svelteCode, {\n filename: id,\n generate: options.ssr ? \"server\" : \"client\",\n runes: options.runes,\n }),\n id,\n );\n\n return {\n code: `${compiled.code}\\nexport const frontmatter = ${JSON.stringify(frontmatter)};`,\n map: compiled.map,\n warnings: compiled.warnings,\n usedComponents,\n frontmatter,\n };\n}\n\nfunction resolveSvelteCompiler(compiler: SvelteCompilerOption | undefined): SvelteCompileFunction {\n if (!compiler) {\n return compileWithDefaultSvelte as SvelteCompileFunction;\n }\n if (typeof compiler === \"function\") {\n return compiler;\n }\n return compiler.compile;\n}\n\nfunction normalizeSvelteCompilerResult(\n result: Awaited<SvelteCompilerResult>,\n id: string,\n): {\n code: string;\n map: unknown;\n warnings: SvelteCompilerWarning[];\n} {\n let value: unknown = result;\n\n if (typeof value === \"string\") {\n const source = value;\n try {\n value = JSON.parse(source) as unknown;\n } catch {\n return { code: source, map: null, warnings: [] };\n }\n }\n\n if (!value || typeof value !== \"object\") {\n throwUnsupportedCompilerResult(id);\n }\n\n const output = value as {\n js?: unknown;\n warnings?: unknown;\n };\n const js = output.js;\n const warnings = Array.isArray(output.warnings)\n ? (output.warnings as SvelteCompilerWarning[])\n : [];\n\n if (typeof js === \"string\") {\n return { code: js, map: null, warnings };\n }\n\n if (js && typeof js === \"object\") {\n const jsOutput = js as { code?: unknown; map?: unknown };\n if (typeof jsOutput.code === \"string\") {\n return { code: jsOutput.code, map: jsOutput.map ?? null, warnings };\n }\n }\n\n throwUnsupportedCompilerResult(id);\n}\n\nfunction throwUnsupportedCompilerResult(id: string): never {\n throw new Error(\n `[ox-content-svelte] Compiler for ${id} returned an unsupported result. Expected { js: { code } } or a compatible JSON string.`,\n );\n}\n\nfunction createIslandMarker(islandId: string): string {\n return `${ISLAND_MARKER_PREFIX}${islandId}${ISLAND_MARKER_SUFFIX}`;\n}\n\nfunction collectFenceRanges(content: string): Range[] {\n const ranges: Range[] = [];\n let inFence = false;\n let fenceChar = \"\";\n let fenceLength = 0;\n let fenceStart = 0;\n let pos = 0;\n\n while (pos < content.length) {\n const lineEnd = content.indexOf(\"\\n\", pos);\n const next = lineEnd === -1 ? content.length : lineEnd + 1;\n const line = content.slice(pos, lineEnd === -1 ? content.length : lineEnd);\n const fenceMatch = line.match(/^\\s{0,3}([`~]{3,})/);\n\n if (fenceMatch) {\n const marker = fenceMatch[1];\n if (!inFence) {\n inFence = true;\n fenceChar = marker[0];\n fenceLength = marker.length;\n fenceStart = pos;\n } else if (marker[0] === fenceChar && marker.length >= fenceLength) {\n inFence = false;\n ranges.push({ start: fenceStart, end: next });\n fenceChar = \"\";\n fenceLength = 0;\n }\n }\n\n pos = next;\n }\n\n if (inFence) {\n ranges.push({ start: fenceStart, end: content.length });\n }\n\n return ranges;\n}\n\nfunction isInRanges(start: number, end: number, ranges: Range[]): boolean {\n for (const range of ranges) {\n if (start < range.end && end > range.start) {\n return true;\n }\n }\n return false;\n}\n\nfunction injectIslandMarkers(html: string, islands: ComponentIsland[]): string {\n let output = html;\n\n for (const island of islands) {\n const marker = createIslandMarker(island.id);\n const propsAttr =\n Object.keys(island.props).length > 0\n ? ` data-ox-props='${JSON.stringify(island.props).replace(/'/g, \"'\")}'`\n : \"\";\n const contentAttr = island.content\n ? ` data-ox-content='${island.content.replace(/'/g, \"'\")}'`\n : \"\";\n const attrs = `data-ox-island=\"${island.name}\"${propsAttr}${contentAttr}`;\n output = output.replaceAll(`<p>${marker}</p>`, `<div ${attrs}></div>`);\n output = output.replaceAll(marker, `<span ${attrs}></span>`);\n }\n\n return output;\n}\n\nfunction extractFrontmatter(content: string): {\n content: string;\n frontmatter: Record<string, unknown>;\n} {\n const frontmatterRegex = /^---\\n([\\s\\S]*?)\\n---\\n/;\n const match = frontmatterRegex.exec(content);\n\n if (!match) {\n return { content, frontmatter: {} };\n }\n\n const frontmatterStr = match[1];\n const frontmatter: Record<string, unknown> = {};\n\n for (const line of frontmatterStr.split(\"\\n\")) {\n const colonIndex = line.indexOf(\":\");\n if (colonIndex > 0) {\n const key = line.slice(0, colonIndex).trim();\n let value: unknown = line.slice(colonIndex + 1).trim();\n try {\n value = JSON.parse(value as string);\n } catch {\n if (\n typeof value === \"string\" &&\n ((value.startsWith('\"') && value.endsWith('\"')) ||\n (value.startsWith(\"'\") && value.endsWith(\"'\")))\n ) {\n value = value.slice(1, -1);\n }\n }\n frontmatter[key] = value;\n }\n }\n\n return { content: content.slice(match[0].length), frontmatter };\n}\n\nfunction parseProps(propsString: string): Record<string, unknown> {\n const props: Record<string, unknown> = {};\n if (!propsString) return props;\n\n PROP_REGEX.lastIndex = 0;\n let match: RegExpExecArray | null;\n while ((match = PROP_REGEX.exec(propsString)) !== null) {\n const [, name, doubleQuoted, singleQuoted, braceValue, bracketValue] = match;\n if (name) {\n if (doubleQuoted !== undefined) props[name] = doubleQuoted;\n else if (singleQuoted !== undefined) props[name] = singleQuoted;\n else if (braceValue !== undefined) {\n try {\n props[name] = JSON.parse(braceValue);\n } catch {\n props[name] = braceValue;\n }\n } else if (bracketValue !== undefined) {\n try {\n props[name] = JSON.parse(`[${bracketValue}]`);\n } catch {\n props[name] = bracketValue;\n }\n } else props[name] = true;\n }\n }\n return props;\n}\n\ninterface MdxDocumentExpression {\n marker: string;\n expression: string;\n path: string[];\n}\n\ninterface PreparedMdxDocumentExpressions {\n content: string;\n expressions: MdxDocumentExpression[];\n}\n\ninterface MdxIslandRange {\n name: string;\n tag: string;\n openStart: number;\n openEnd: number;\n innerStart: number;\n contentStart: number;\n closeStart: number;\n closeEnd: number;\n propsAttr?: string;\n script?: string;\n}\n\ninterface MdxIslandPayload {\n props: Record<string, unknown>;\n expressions: Record<string, string>;\n spreads: string[];\n}\n\ninterface MdxTemplateContext {\n html: string;\n filePath: string;\n usedComponents: Set<string>;\n expressionsByMarker: Map<string, MdxDocumentExpression>;\n islandRanges: MdxIslandRange[];\n /** Components that carried `oxIsland`, in document order. */\n hydratedIslands: Set<string>;\n}\n\n/** Opt a document-props component into the island contract. */\nconst MDX_ISLAND_DIRECTIVE = \"oxIsland\";\nconst MDX_ISLAND_MEDIA_DIRECTIVE = \"oxIslandMedia\";\nconst MDX_ISLAND_LOAD_STRATEGIES = new Set([\"eager\", \"idle\", \"visible\", \"media\"]);\n\ninterface MdxIslandHydration {\n load: string;\n media?: string;\n}\n\nfunction prepareMdxDocumentExpressions(\n content: string,\n filePath: string,\n): PreparedMdxDocumentExpressions {\n const skipRanges = mergeRanges([\n ...collectFenceRanges(content),\n ...collectInlineCodeRanges(content),\n ...collectMdxEsmLineRanges(content),\n ]);\n const expressions: MdxDocumentExpression[] = [];\n let output = \"\";\n let cursor = 0;\n let rangeIndex = 0;\n let inTag = false;\n let quote: string | null = null;\n\n while (cursor < content.length) {\n const range = skipRanges[rangeIndex];\n if (range && cursor >= range.end) {\n rangeIndex += 1;\n continue;\n }\n if (range && cursor === range.start) {\n output += content.slice(range.start, range.end);\n cursor = range.end;\n continue;\n }\n\n const char = content[cursor]!;\n if (inTag) {\n output += char;\n if (quote) {\n if (char === quote && content[cursor - 1] !== \"\\\\\") {\n quote = null;\n }\n } else if (char === '\"' || char === \"'\") {\n quote = char;\n } else if (char === \">\") {\n inTag = false;\n }\n cursor += 1;\n continue;\n }\n\n if (char === \"<\" && startsHtmlLikeTag(content, cursor)) {\n inTag = true;\n output += char;\n cursor += 1;\n continue;\n }\n\n if (char === \"{\" && content[cursor - 1] !== \"\\\\\") {\n const end = findMdxExpressionEnd(content, cursor + 1);\n if (end !== -1) {\n const expression = content.slice(cursor + 1, end).trim();\n const path = parseDocumentPropPath(expression);\n if (!path) {\n throw new Error(\n `[ox-content-svelte] Unsupported MDX document prop expression \"{${expression}}\" in ${filePath}. Only identifiers and dotted property paths are supported.`,\n );\n }\n const marker = `${DOCUMENT_PROP_MARKER_PREFIX}${expressions.length}${DOCUMENT_PROP_MARKER_SUFFIX}`;\n expressions.push({ marker, expression, path });\n output += marker;\n cursor = end + 1;\n continue;\n }\n }\n\n output += char;\n cursor += 1;\n }\n\n return { content: output, expressions };\n}\n\nfunction collectInlineCodeRanges(content: string): Range[] {\n const ranges: Range[] = [];\n const fenceRanges = collectFenceRanges(content);\n let lineStart = 0;\n\n while (lineStart < content.length) {\n const lineEnd = content.indexOf(\"\\n\", lineStart);\n const end = lineEnd === -1 ? content.length : lineEnd;\n if (!isInRanges(lineStart, end, fenceRanges)) {\n let cursor = lineStart;\n while (cursor < end) {\n const marker = matchBacktickRun(content, cursor);\n if (!marker) {\n cursor += 1;\n continue;\n }\n const close = content.indexOf(marker, cursor + marker.length);\n if (close === -1 || close >= end) {\n cursor += marker.length;\n continue;\n }\n ranges.push({ start: cursor, end: close + marker.length });\n cursor = close + marker.length;\n }\n }\n lineStart = lineEnd === -1 ? content.length : lineEnd + 1;\n }\n\n return ranges;\n}\n\nfunction collectMdxEsmLineRanges(content: string): Range[] {\n const ranges: Range[] = [];\n const fenceRanges = collectFenceRanges(content);\n let lineStart = 0;\n\n while (lineStart < content.length) {\n const lineEnd = content.indexOf(\"\\n\", lineStart);\n const end = lineEnd === -1 ? content.length : lineEnd + 1;\n const contentEnd = lineEnd === -1 ? content.length : lineEnd;\n if (!isInRanges(lineStart, contentEnd, fenceRanges)) {\n const line = content.slice(lineStart, contentEnd).trimStart();\n if (line.startsWith(\"import \") || line.startsWith(\"export \")) {\n ranges.push({ start: lineStart, end });\n }\n }\n lineStart = lineEnd === -1 ? content.length : lineEnd + 1;\n }\n\n return ranges;\n}\n\nfunction mergeRanges(ranges: Range[]): Range[] {\n const sorted = ranges\n .filter((range) => range.end > range.start)\n .sort((left, right) => left.start - right.start || left.end - right.end);\n const merged: Range[] = [];\n\n for (const range of sorted) {\n const previous = merged.at(-1);\n if (previous && range.start <= previous.end) {\n previous.end = Math.max(previous.end, range.end);\n } else {\n merged.push({ ...range });\n }\n }\n\n return merged;\n}\n\nfunction matchBacktickRun(content: string, index: number): string | null {\n if (content[index] !== \"`\") return null;\n let end = index + 1;\n while (content[end] === \"`\") {\n end += 1;\n }\n return content.slice(index, end);\n}\n\nfunction startsHtmlLikeTag(content: string, index: number): boolean {\n const next = content[index + 1];\n return next === \"/\" || next === \"!\" || next === \"?\" || /[A-Za-z]/.test(next ?? \"\");\n}\n\nfunction findMdxExpressionEnd(content: string, start: number): number {\n let depth = 1;\n let quote: string | null = null;\n let escaped = false;\n\n for (let index = start; index < content.length; index += 1) {\n const char = content[index]!;\n if (quote) {\n if (escaped) {\n escaped = false;\n } else if (char === \"\\\\\") {\n escaped = true;\n } else if (char === quote) {\n quote = null;\n }\n continue;\n }\n\n if (char === '\"' || char === \"'\" || char === \"`\") {\n quote = char;\n continue;\n }\n if (char === \"{\") {\n depth += 1;\n continue;\n }\n if (char === \"}\") {\n depth -= 1;\n if (depth === 0) return index;\n }\n }\n\n return -1;\n}\n\nfunction parseDocumentPropPath(expression: string): string[] | null {\n if (\n !/^[A-Za-z_$][\\w$]*(?:\\.[A-Za-z_$][\\w$]*)*$/.test(expression) ||\n RESERVED_DOCUMENT_PROP_WORDS.has(expression)\n ) {\n return null;\n }\n return expression.split(\".\");\n}\n\nconst RESERVED_DOCUMENT_PROP_WORDS = new Set([\n \"false\",\n \"Infinity\",\n \"NaN\",\n \"null\",\n \"this\",\n \"true\",\n \"undefined\",\n]);\n\nfunction generateMdxDocumentPropsSvelteModule(\n html: string,\n usedComponents: string[],\n frontmatter: Record<string, unknown>,\n options: ResolvedSvelteOptions & { root?: string },\n id: string,\n localBindings: ReadonlyMap<string, ResolvedDocumentComponentImport>,\n documentExpressions: readonly MdxDocumentExpression[],\n): string {\n const filePathLiteral = JSON.stringify(id);\n const imports = renderIslandComponentImports(usedComponents, {\n globalComponents: options.components,\n localBindings,\n documentPath: id,\n root: options.root,\n });\n const { template, hydratedIslands } = renderMdxDocumentTemplate(\n html,\n usedComponents,\n id,\n documentExpressions,\n );\n const moduleScript = renderMdxIslandModuleScript(hydratedIslands, imports);\n\n return `${moduleScript}\n<script>\n ${hydratedIslands.length > 0 ? \"\" : imports}\n\n const frontmatter = ${JSON.stringify(frontmatter)};\n export { frontmatter };\n\n let __ox_mdx_props = $props();\n${hydratedIslands.length > 0 ? renderMdxIslandPropsSerializer(filePathLiteral) : \"\"}\n\n function __ox_mdx_document_prop(props, path, expression) {\n const propName = path.join(\".\");\n let value = props;\n for (const segment of path) {\n if (\n value == null ||\n (typeof value !== \"object\" && typeof value !== \"function\") ||\n !(segment in Object(value))\n ) {\n throw new Error('[ox-content-svelte] Missing MDX document prop \"' + propName + '\" in ' + ${filePathLiteral} + ' for expression {' + expression + '}.');\n }\n value = value[segment];\n }\n if (value === undefined) {\n throw new Error('[ox-content-svelte] Missing MDX document prop \"' + propName + '\" in ' + ${filePathLiteral} + ' for expression {' + expression + '}.');\n }\n return value;\n }\n</script>\n\n<div class=\"ox-content\">${template}</div>\n\n<style>\n .ox-content {\n line-height: 1.6;\n }\n</style>\n`;\n}\n\n/**\n * Island wiring for a document-props page.\n *\n * This host never hydrates the whole page — that is the point of the mode — so\n * the runtime cannot be started from `onMount`. It is exported instead, and the\n * host calls it once on the client. Pages with no islands get no module script\n * at all and stay zero-JavaScript.\n */\nfunction renderMdxIslandModuleScript(hydratedIslands: readonly string[], imports: string): string {\n if (hydratedIslands.length === 0) return \"\";\n const registry = hydratedIslands.map((name) => ` ${name},`).join(\"\\n\");\n\n return `\n<script module>\n import { createRawSnippet, hydrate, mount, unmount } from 'svelte';\n import { initIslands, readIslandSlotHtml } from '@ox-content/islands';\n ${imports}\n\n const __ox_island_components = {\n${registry}\n };\n\n export function hydrateIslands(options) {\n return initIslands((element, props) => {\n const Component = __ox_island_components[element.dataset.oxIsland];\n if (!Component) return;\n\n const islandContent = readIslandSlotHtml(element);\n const componentProps = { ...props };\n if (islandContent) {\n componentProps.children = createRawSnippet(() => ({\n render: () => \\`<div>\\${islandContent}</div>\\`,\n }));\n }\n\n const attach = element.dataset.oxSsr === 'true' ? hydrate : mount;\n const instance = attach(Component, { target: element, props: componentProps });\n return () => unmount(instance);\n }, { selector: '[data-ox-island]', ...options });\n }\n</script>`;\n}\n\n/**\n * `JSON.stringify` drops functions and `undefined` silently and throws an\n * opaque error on a cycle, either of which turns into an island that renders\n * but never comes alive. Walking first turns both into a build diagnostic that\n * names the prop.\n */\nfunction renderMdxIslandPropsSerializer(filePathLiteral: string): string {\n return `\n function __ox_mdx_island_props(componentName, props) {\n const seen = new WeakSet();\n const check = (value, path) => {\n const kind = typeof value;\n if (value === null || kind === 'string' || kind === 'number' || kind === 'boolean') return;\n if (kind !== 'object') {\n throw new Error('[ox-content-svelte] Island \"' + componentName + '\" in ' + ${filePathLiteral} + ' received a ' + kind + ' for prop \"' + path + '\", which cannot be serialised for hydration. Pass a JSON value, or drop ${MDX_ISLAND_DIRECTIVE} to keep the component server-only.');\n }\n if (seen.has(value)) {\n throw new Error('[ox-content-svelte] Island \"' + componentName + '\" in ' + ${filePathLiteral} + ' received a circular value for prop \"' + path + '\", which cannot be serialised for hydration.');\n }\n seen.add(value);\n if (Array.isArray(value)) {\n value.forEach((item, index) => check(item, path + '[' + index + ']'));\n return;\n }\n for (const key of Object.keys(value)) check(value[key], path ? path + '.' + key : key);\n };\n for (const key of Object.keys(props)) check(props[key], key);\n return JSON.stringify(props);\n }\n`;\n}\n\nfunction renderMdxDocumentTemplate(\n html: string,\n usedComponents: string[],\n filePath: string,\n documentExpressions: readonly MdxDocumentExpression[],\n): { template: string; hydratedIslands: string[] } {\n const context: MdxTemplateContext = {\n html,\n filePath,\n usedComponents: new Set(usedComponents),\n expressionsByMarker: new Map(\n documentExpressions.map((expression) => [expression.marker, expression] as const),\n ),\n islandRanges: findMdxIslandRanges(html),\n hydratedIslands: new Set(),\n };\n const template = renderHtmlRange(context, 0, html.length);\n return { template, hydratedIslands: [...context.hydratedIslands] };\n}\n\nfunction renderHtmlRange(context: MdxTemplateContext, start: number, end: number): string {\n let output = \"\";\n let cursor = start;\n\n while (cursor < end) {\n const island = findNextIslandRange(context, cursor, end);\n if (!island) {\n output += renderRawHtmlTemplate(context.html.slice(cursor, end), context.expressionsByMarker);\n break;\n }\n\n output += renderRawHtmlTemplate(\n context.html.slice(cursor, island.openStart),\n context.expressionsByMarker,\n );\n output += renderMdxIslandTemplate(context, island);\n cursor = island.closeEnd;\n }\n\n return output;\n}\n\nfunction findNextIslandRange(\n context: MdxTemplateContext,\n cursor: number,\n end: number,\n): MdxIslandRange | null {\n for (const island of context.islandRanges) {\n if (island.openStart < cursor || island.closeEnd > end) {\n continue;\n }\n if (context.usedComponents.has(island.name)) {\n return island;\n }\n }\n return null;\n}\n\nfunction renderRawHtmlTemplate(\n html: string,\n expressionsByMarker: ReadonlyMap<string, MdxDocumentExpression>,\n): string {\n if (!html) return \"\";\n let output = \"\";\n let cursor = 0;\n\n while (cursor < html.length) {\n const next = findNextDocumentExpressionMarker(html, cursor, expressionsByMarker);\n if (!next) {\n output += renderRawHtmlBlock(html.slice(cursor));\n break;\n }\n output += renderRawHtmlBlock(html.slice(cursor, next.index));\n output += renderDocumentExpression(next.expression);\n cursor = next.index + next.expression.marker.length;\n }\n\n return output;\n}\n\nfunction findNextDocumentExpressionMarker(\n html: string,\n start: number,\n expressionsByMarker: ReadonlyMap<string, MdxDocumentExpression>,\n): { index: number; expression: MdxDocumentExpression } | null {\n let nextIndex = -1;\n let nextExpression: MdxDocumentExpression | undefined;\n\n for (const expression of expressionsByMarker.values()) {\n const index = html.indexOf(expression.marker, start);\n if (index !== -1 && (nextIndex === -1 || index < nextIndex)) {\n nextIndex = index;\n nextExpression = expression;\n }\n }\n\n return nextExpression ? { index: nextIndex, expression: nextExpression } : null;\n}\n\nfunction renderRawHtmlBlock(html: string): string {\n return html ? `{@html ${JSON.stringify(html).replaceAll(\"</script\", \"<\\\\/script\")}}` : \"\";\n}\n\nfunction renderDocumentExpression(expression: MdxDocumentExpression): string {\n return `{${documentPropResolverExpression(expression.path, expression.expression)}}`;\n}\n\nfunction renderMdxIslandTemplate(context: MdxTemplateContext, island: MdxIslandRange): string {\n assertSvelteComponentName(island.name, context.filePath);\n const payload = readMdxIslandPayload(island);\n const hydration = takeMdxIslandHydration(payload, island.name, context.filePath);\n const attrs = renderMdxIslandAttributes(payload, context.filePath);\n const children = renderHtmlRange(context, island.contentStart, island.closeStart);\n const element = children\n ? `<${island.name}${attrs}>${children}</${island.name}>`\n : `<${island.name}${attrs} />`;\n\n if (!hydration) return element;\n\n // The component still renders server-side, inside the wrapper, so the island\n // runtime can hydrate the existing DOM instead of mounting a second copy.\n context.hydratedIslands.add(island.name);\n const wrapperAttrs = [\n `data-ox-island=\"${island.name}\"`,\n 'data-ox-ssr=\"true\"',\n `data-ox-load=\"${hydration.load}\"`,\n ];\n if (hydration.media) wrapperAttrs.push(`data-ox-media=${JSON.stringify(hydration.media)}`);\n wrapperAttrs.push(\n `data-ox-props={${mdxIslandPropsExpression(payload, island.name, context.filePath)}}`,\n );\n return `<div ${wrapperAttrs.join(\" \")}>${element}</div>`;\n}\n\n/**\n * Reads and removes the island directives so they never reach the component.\n *\n * The strategy is a build-time decision, so it has to be a literal: resolving\n * it from a document prop would mean the wrapper could not be written until\n * render time, by which point the load strategy has already been read.\n */\nfunction takeMdxIslandHydration(\n payload: MdxIslandPayload,\n name: string,\n filePath: string,\n): MdxIslandHydration | undefined {\n for (const directive of [MDX_ISLAND_DIRECTIVE, MDX_ISLAND_MEDIA_DIRECTIVE]) {\n if (directive in payload.expressions) {\n throw new Error(\n `[ox-content-svelte] \"${directive}\" on <${name}> in ${filePath} has to be a literal, not a document prop: the load strategy is chosen when the page is built.`,\n );\n }\n }\n if (!(MDX_ISLAND_DIRECTIVE in payload.props)) return undefined;\n\n const raw = payload.props[MDX_ISLAND_DIRECTIVE];\n const media = payload.props[MDX_ISLAND_MEDIA_DIRECTIVE];\n delete payload.props[MDX_ISLAND_DIRECTIVE];\n delete payload.props[MDX_ISLAND_MEDIA_DIRECTIVE];\n\n const load = raw === true || raw === \"\" ? \"eager\" : raw;\n if (typeof load !== \"string\" || !MDX_ISLAND_LOAD_STRATEGIES.has(load)) {\n throw new Error(\n `[ox-content-svelte] Unknown island load strategy ${JSON.stringify(raw)} on <${name}> in ${filePath}. Use ${[...MDX_ISLAND_LOAD_STRATEGIES].join(\", \")}.`,\n );\n }\n if (load === \"media\" && typeof media !== \"string\") {\n throw new Error(\n `[ox-content-svelte] <${name} ${MDX_ISLAND_DIRECTIVE}=\"media\"> in ${filePath} needs ${MDX_ISLAND_MEDIA_DIRECTIVE} with the query to wait for.`,\n );\n }\n return { load, media: typeof media === \"string\" ? media : undefined };\n}\n\n/**\n * The same props the component is rendered with, serialised for the client.\n *\n * Built in attribute order so a spread and a named prop resolve the way Svelte\n * resolves them in the template above.\n */\nfunction mdxIslandPropsExpression(\n payload: MdxIslandPayload,\n name: string,\n filePath: string,\n): string {\n const parts: string[] = [];\n\n for (const spread of payload.spreads) {\n const expression = spread.trim().startsWith(\"...\")\n ? spread.trim().slice(3).trim()\n : spread.trim();\n const path = parseDocumentPropPath(expression);\n if (!path) {\n throw new Error(\n `[ox-content-svelte] Unsupported MDX document prop spread \"{${spread}}\" in ${filePath}. Only identifiers and dotted property paths are supported.`,\n );\n }\n parts.push(documentPropResolverExpression(path, expression));\n }\n\n const entries: string[] = [];\n for (const [key, value] of Object.entries(payload.props)) {\n entries.push(`${JSON.stringify(key)}: ${renderSvelteLiteral(value)}`);\n }\n for (const [key, expression] of Object.entries(payload.expressions)) {\n const path = parseDocumentPropPath(expression.trim());\n if (!path) {\n throw new Error(\n `[ox-content-svelte] Unsupported MDX document prop expression \"{${expression}}\" for prop \"${key}\" in ${filePath}. Only identifiers and dotted property paths are supported.`,\n );\n }\n entries.push(\n `${JSON.stringify(key)}: ${documentPropResolverExpression(path, expression.trim())}`,\n );\n }\n if (entries.length > 0) parts.push(`{ ${entries.join(\", \")} }`);\n\n const merged =\n parts.length === 0\n ? \"{}\"\n : parts.length === 1\n ? parts[0]\n : `Object.assign({}, ${parts.join(\", \")})`;\n return `__ox_mdx_island_props(${JSON.stringify(name)}, ${merged})`;\n}\n\nfunction renderMdxIslandAttributes(payload: MdxIslandPayload, filePath: string): string {\n const attrs: string[] = [];\n\n for (const spread of payload.spreads) {\n const expression = spread.trim().startsWith(\"...\")\n ? spread.trim().slice(3).trim()\n : spread.trim();\n const path = parseDocumentPropPath(expression);\n if (!path) {\n throw new Error(\n `[ox-content-svelte] Unsupported MDX document prop spread \"{${spread}}\" in ${filePath}. Only identifiers and dotted property paths are supported.`,\n );\n }\n attrs.push(`{...${documentPropResolverExpression(path, expression)}}`);\n }\n\n for (const [name, value] of Object.entries(payload.props)) {\n assertSvelteAttributeName(name, filePath);\n attrs.push(`${name}={${renderSvelteLiteral(value)}}`);\n }\n\n for (const [name, expression] of Object.entries(payload.expressions)) {\n assertSvelteAttributeName(name, filePath);\n const path = parseDocumentPropPath(expression.trim());\n if (!path) {\n throw new Error(\n `[ox-content-svelte] Unsupported MDX document prop expression \"{${expression}}\" for prop \"${name}\" in ${filePath}. Only identifiers and dotted property paths are supported.`,\n );\n }\n attrs.push(`${name}={${documentPropResolverExpression(path, expression.trim())}}`);\n }\n\n return attrs.length > 0 ? ` ${attrs.join(\" \")}` : \"\";\n}\n\nfunction documentPropResolverExpression(path: readonly string[], expression: string): string {\n return `__ox_mdx_document_prop(__ox_mdx_props, ${JSON.stringify(path)}, ${JSON.stringify(expression)})`;\n}\n\nfunction renderSvelteLiteral(value: unknown): string {\n const literal = JSON.stringify(value);\n return literal === undefined ? \"undefined\" : literal.replaceAll(\"</script\", \"<\\\\/script\");\n}\n\nfunction findMdxIslandRanges(html: string): MdxIslandRange[] {\n const ranges: MdxIslandRange[] = [];\n const openRe = /<(div|span)\\b([^>]*\\bdata-ox-island=\"([^\"]+)\"[^>]*)>/gi;\n let match: RegExpExecArray | null;\n\n while ((match = openRe.exec(html)) !== null) {\n const tag = match[1]!;\n const name = decodeHtmlAttr(match[3] ?? \"\");\n if (!name) continue;\n const openStart = match.index;\n const openEnd = match.index + match[0].length;\n const closeStart = findMatchingClose(html, openEnd, tag);\n const closeEnd = closeStart < html.length ? closeStart + tag.length + 3 : html.length;\n const inner = html.slice(openEnd, closeStart);\n const scriptMatch = inner.match(PAYLOAD_SCRIPT);\n const script = scriptMatch?.[0];\n ranges.push({\n name,\n tag,\n openStart,\n openEnd,\n innerStart: openEnd,\n contentStart: openEnd + (script?.length ?? 0),\n closeStart,\n closeEnd,\n propsAttr: matchAttr(match[2] ?? \"\", \"data-ox-props\"),\n script,\n });\n }\n\n return ranges.sort((left, right) => left.openStart - right.openStart);\n}\n\nfunction findMatchingClose(html: string, from: number, tag: string): number {\n const openNeedle = `<${tag}`;\n const closeNeedle = `</${tag}>`;\n let depth = 1;\n let cursor = from;\n\n while (cursor < html.length) {\n const nextOpen = indexOfTagOpen(html, openNeedle, cursor);\n const nextClose = html.indexOf(closeNeedle, cursor);\n if (nextClose === -1) return html.length;\n if (nextOpen !== -1 && nextOpen < nextClose) {\n depth += 1;\n cursor = nextOpen + openNeedle.length;\n } else {\n depth -= 1;\n if (depth === 0) return nextClose;\n cursor = nextClose + closeNeedle.length;\n }\n }\n\n return html.length;\n}\n\nfunction indexOfTagOpen(html: string, openNeedle: string, from: number): number {\n let cursor = from;\n while (cursor < html.length) {\n const index = html.indexOf(openNeedle, cursor);\n if (index === -1) return -1;\n const next = html[index + openNeedle.length];\n if (next === \" \" || next === \">\" || next === \"\\t\" || next === \"\\n\" || next === \"/\") {\n return index;\n }\n cursor = index + openNeedle.length;\n }\n return -1;\n}\n\nfunction matchAttr(attrs: string, name: string): string | undefined {\n const match = new RegExp(`\\\\b${name}=\"([^\"]*)\"`, \"i\").exec(attrs);\n return match?.[1] === undefined ? undefined : decodeHtmlAttr(match[1]);\n}\n\nfunction readMdxIslandPayload(island: MdxIslandRange): MdxIslandPayload {\n const fromAttr = island.propsAttr ? tryParseJson(island.propsAttr) : undefined;\n const fromScript = island.script\n ? tryParseJson(\n island.script.match(/<script type=\"application\\/json\">([\\s\\S]*?)<\\/script>/i)?.[1] ?? \"\",\n )\n : undefined;\n return normalizeMdxIslandPayload(fromAttr ?? fromScript ?? {});\n}\n\nfunction normalizeMdxIslandPayload(parsed: unknown): MdxIslandPayload {\n if (!parsed || typeof parsed !== \"object\" || Array.isArray(parsed)) {\n return { props: {}, expressions: {}, spreads: [] };\n }\n\n const record = parsed as Record<string, unknown>;\n const keys = Object.keys(record);\n if (keys.length > 0 && keys.every((key) => RUST_PAYLOAD_KEYS.has(key))) {\n return {\n props: toRecord(record.props),\n expressions: toStringRecord(record.expressions),\n spreads: toStringArray(record.spreads),\n };\n }\n\n return { props: record, expressions: {}, spreads: [] };\n}\n\nfunction toRecord(value: unknown): Record<string, unknown> {\n return value && typeof value === \"object\" && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : {};\n}\n\nfunction toStringRecord(value: unknown): Record<string, string> {\n const record = toRecord(value);\n const output: Record<string, string> = {};\n for (const [key, entry] of Object.entries(record)) {\n if (typeof entry === \"string\") {\n output[key] = entry;\n }\n }\n return output;\n}\n\nfunction toStringArray(value: unknown): string[] {\n return Array.isArray(value)\n ? value.filter((entry): entry is string => typeof entry === \"string\")\n : [];\n}\n\nfunction tryParseJson(value: string): unknown {\n try {\n return JSON.parse(value);\n } catch {\n return undefined;\n }\n}\n\nfunction decodeHtmlAttr(value: string): string {\n return value\n .replaceAll(\""\", '\"')\n .replaceAll(\"'\", \"'\")\n .replaceAll(\"<\", \"<\")\n .replaceAll(\">\", \">\")\n .replaceAll(\"&\", \"&\");\n}\n\nfunction assertSvelteComponentName(name: string, filePath: string): void {\n if (!/^[A-Z][A-Za-z0-9_$]*$/.test(name)) {\n throw new Error(\n `[ox-content-svelte] Unsupported MDX component name \"${name}\" in ${filePath} for mdxDocumentProps. Only simple Svelte component identifiers are supported.`,\n );\n }\n}\n\nfunction assertSvelteAttributeName(name: string, filePath: string): void {\n if (!/^[A-Za-z_$][\\w$-]*$/.test(name)) {\n throw new Error(\n `[ox-content-svelte] Unsupported MDX component prop name \"${name}\" in ${filePath}.`,\n );\n }\n}\n\nfunction generateSvelteModule(\n content: string,\n usedComponents: string[],\n _islands: ComponentIsland[] | string[],\n frontmatter: Record<string, unknown>,\n options: ResolvedSvelteOptions & { root?: string },\n id: string,\n localBindings?: ReadonlyMap<string, ResolvedDocumentComponentImport>,\n): string {\n // Rust island payloads include `</script>`; that must not close this SFC block.\n const rawHtmlLiteral = JSON.stringify(content).replaceAll(\"</script\", \"<\\\\/script\");\n\n const imports = renderIslandComponentImports(usedComponents, {\n globalComponents: options.components,\n localBindings,\n documentPath: id,\n root: options.root,\n });\n\n // If no registered islands, generate simpler code without island runtime\n if (usedComponents.length === 0) {\n return `\n<script>\n const frontmatter = ${JSON.stringify(frontmatter)};\n const rawHtml = ${rawHtmlLiteral};\n\n export { frontmatter };\n</script>\n\n<div class=\"ox-content\">\n {@html rawHtml}\n</div>\n\n<style>\n .ox-content {\n line-height: 1.6;\n }\n</style>\n`;\n }\n\n const componentMap = usedComponents.map((name) => ` ${name},`).join(\"\\n\");\n\n return `\n<script>\n import { createRawSnippet, hydrate, mount, onMount, unmount } from 'svelte';\n import { initIslands, readIslandSlotHtml } from '@ox-content/islands';\n ${imports}\n\n const frontmatter = ${JSON.stringify(frontmatter)};\n const rawHtml = ${rawHtmlLiteral};\n const components = {\n${componentMap}\n };\n\n export { frontmatter };\n\n let container;\n\n function createSvelteHydrate() {\n const mounted = [];\n\n return (element, props) => {\n const componentName = element.dataset.oxIsland;\n const Component = components[componentName];\n if (!Component) return;\n\n const islandContent = readIslandSlotHtml(element);\n const componentProps = { ...props };\n if (islandContent) {\n componentProps.children = createRawSnippet(() => ({\n render: () => \\`<div>\\${islandContent}</div>\\`,\n }));\n }\n\n const attach = element.dataset.oxSsr === 'true' ? hydrate : mount;\n const instance = attach(Component, { target: element, props: componentProps });\n mounted.push(instance);\n\n return () => unmount(instance);\n };\n }\n\n onMount(() => {\n if (!container) return;\n const controller = initIslands(createSvelteHydrate(), {\n selector: '.ox-content [data-ox-island]',\n });\n return () => controller.destroy();\n });\n</script>\n\n<div class=\"ox-content\" bind:this={container}>\n {@html rawHtml}\n</div>\n\n<style>\n .ox-content {\n line-height: 1.6;\n }\n</style>\n`;\n}\n","import type { EnvironmentOptions } from \"vite\";\n\nexport function createSvelteMarkdownEnvironment(\n mode: \"ssr\" | \"client\",\n options: { outDir: string },\n): EnvironmentOptions {\n const isSSR = mode === \"ssr\";\n\n return {\n build: {\n outDir: isSSR ? `${options.outDir}/.ox-content/ssr` : `${options.outDir}/.ox-content/client`,\n ssr: isSSR,\n rollupOptions: {\n output: {\n format: \"esm\",\n entryFileNames: isSSR ? \"[name].js\" : \"[name].[hash].js\",\n },\n },\n ...(isSSR && { target: \"node18\", minify: false }),\n },\n resolve: {\n conditions: isSSR ? [\"node\", \"import\"] : [\"browser\", \"import\"],\n },\n optimizeDeps: {\n include: isSSR ? [] : [\"svelte\"],\n exclude: [\"@ox-content/vite-plugin\", \"@ox-content/vite-plugin-svelte\"],\n },\n };\n}\n","/**\n * Resolves the `components` option into a name → path map, expanding glob\n * patterns against the Vite project root.\n */\n\nimport * as fs from \"fs\";\nimport * as path from \"path\";\nimport type { ComponentsMap, ComponentsOption } from \"./types\";\n\nexport async function resolveComponentsGlob(\n componentsOption: ComponentsOption,\n root: string,\n): Promise<ComponentsMap> {\n if (typeof componentsOption === \"object\" && !Array.isArray(componentsOption)) {\n return componentsOption;\n }\n\n const patterns = Array.isArray(componentsOption) ? componentsOption : [componentsOption];\n const result: ComponentsMap = {};\n\n for (const pattern of patterns) {\n for (const file of await globFiles(pattern, root)) {\n const baseName = path.basename(file, path.extname(file));\n const relativePath = \"./\" + path.relative(root, file).replace(/\\\\/g, \"/\");\n result[toPascalCase(baseName)] = relativePath;\n }\n }\n\n return result;\n}\n\nasync function globFiles(pattern: string, root: string): Promise<string[]> {\n const files: string[] = [];\n const normalized = pattern.replace(/\\\\/g, \"/\").replace(/^\\.\\//, \"\");\n\n if (!hasWildcard(normalized)) {\n const fullPath = path.resolve(root, normalized);\n if (fs.existsSync(fullPath)) {\n files.push(fullPath);\n }\n return files;\n }\n\n // Walk from the deepest wildcard-free prefix, then keep only the paths the\n // whole pattern matches. Deriving the base directory alone is not enough:\n // `src/components/**/*.tsx` must not collect the non-component files below\n // `src/components`, and the generated module would fail to import them.\n const baseDir = path.resolve(root, staticPrefix(normalized));\n if (!fs.existsSync(baseDir)) {\n return files;\n }\n\n // Only a pattern whose wildcards are confined to the file name can stay\n // shallow. A wildcard in a directory segment (`src/*/Button.tsx`) puts its\n // matches below `baseDir`, and `**` crosses directory boundaries even inside\n // the last segment, so both need the recursive walk.\n const segments = normalized.split(\"/\");\n const crossesDirectories = normalized.includes(\"**\") || segments.slice(0, -1).some(hasWildcard);\n\n const candidates: string[] = [];\n if (crossesDirectories) {\n await walkDir(baseDir, candidates);\n } else {\n const entries = await fs.promises.readdir(baseDir, { withFileTypes: true });\n for (const entry of entries) {\n if (entry.isFile()) {\n candidates.push(path.join(baseDir, entry.name));\n }\n }\n }\n\n const matcher = globToRegExp(normalized);\n for (const candidate of candidates) {\n if (matcher.test(path.relative(root, candidate).replace(/\\\\/g, \"/\"))) {\n files.push(candidate);\n }\n }\n\n return files;\n}\n\n/** Whether a pattern (or one segment of it) contains a wildcard `globToRegExp` expands. */\nfunction hasWildcard(pattern: string): boolean {\n return pattern.includes(\"*\") || pattern.includes(\"?\");\n}\n\n/** Leading path segments of a pattern that contain no wildcard. */\nfunction staticPrefix(pattern: string): string {\n const segments: string[] = [];\n for (const segment of pattern.split(\"/\")) {\n if (hasWildcard(segment)) break;\n segments.push(segment);\n }\n return segments.join(\"/\");\n}\n\n/**\n * Translates a glob into an anchored `RegExp`: `**` crosses directory\n * boundaries, `*` and `?` stay within one segment.\n */\nfunction globToRegExp(pattern: string): RegExp {\n let source = \"\";\n let index = 0;\n\n while (index < pattern.length) {\n const char = pattern[index];\n if (char === \"*\") {\n if (pattern[index + 1] === \"*\") {\n index += 2;\n if (pattern[index] === \"/\") {\n index += 1;\n source += \"(?:[^/]+/)*\";\n } else {\n source += \".*\";\n }\n continue;\n }\n source += \"[^/]*\";\n } else if (char === \"?\") {\n source += \"[^/]\";\n } else {\n source += char.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n }\n index += 1;\n }\n\n return new RegExp(`^${source}$`);\n}\n\nasync function walkDir(dir: string, files: string[]): Promise<void> {\n const entries = await fs.promises.readdir(dir, { withFileTypes: true });\n\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name);\n\n if (entry.isDirectory()) {\n await walkDir(fullPath, files);\n } else if (entry.isFile()) {\n files.push(fullPath);\n }\n }\n}\n\nfunction toPascalCase(str: string): string {\n return str.replace(/[-_](\\w)/g, (_, c) => c.toUpperCase()).replace(/^\\w/, (c) => c.toUpperCase());\n}\n","import type { SvelteHtmlComponentRenderer, SvelteServerModuleLoader } from \"./html-host\";\n\ntype SvelteServerRuntime = {\n render: (\n component: never,\n options: { props?: Record<string, unknown> },\n ) => { body?: string; html?: string };\n};\n\ntype SvelteSharedRuntime = {\n createRawSnippet: (\n factory: () => {\n render: () => string;\n },\n ) => unknown;\n};\n\nexport const defaultRenderSvelteHtmlComponent: SvelteHtmlComponentRenderer = async (\n component,\n props,\n slotHtml,\n) => {\n const runtime = await loadDefaultSvelteRuntime();\n return renderWithSvelteRuntime(runtime, component, props, slotHtml);\n};\n\nexport function createSvelteHtmlHostComponentRenderer(\n loadModule: SvelteServerModuleLoader,\n): SvelteHtmlComponentRenderer {\n let pending: Promise<ResolvedSvelteRuntime> | undefined;\n\n return async (component, props, slotHtml) => {\n pending ??= loadSvelteRuntimeFromHost(loadModule);\n return renderWithSvelteRuntime(await pending, component, props, slotHtml);\n };\n}\n\ntype ResolvedSvelteRuntime = {\n render: SvelteServerRuntime[\"render\"];\n createRawSnippet: SvelteSharedRuntime[\"createRawSnippet\"];\n};\n\nasync function loadDefaultSvelteRuntime(): Promise<ResolvedSvelteRuntime> {\n const [server, shared] = await Promise.all([import(\"svelte/server\"), import(\"svelte\")]);\n return resolveSvelteRuntime(server, shared);\n}\n\nasync function loadSvelteRuntimeFromHost(\n loadModule: SvelteServerModuleLoader,\n): Promise<ResolvedSvelteRuntime> {\n const [server, shared] = await Promise.all([loadModule(\"svelte/server\"), loadModule(\"svelte\")]);\n return resolveSvelteRuntime(server, shared);\n}\n\nfunction renderWithSvelteRuntime(\n runtime: ResolvedSvelteRuntime,\n component: unknown,\n props: Record<string, unknown>,\n slotHtml: string | undefined,\n): string {\n const componentProps = slotHtml\n ? { ...props, children: runtime.createRawSnippet(() => ({ render: () => slotHtml })) }\n : props;\n const rendered = runtime.render(component as never, { props: componentProps });\n return rendered.html ?? rendered.body ?? \"\";\n}\n\nfunction resolveSvelteRuntime(server: unknown, shared: unknown): ResolvedSvelteRuntime {\n return {\n render: runtimeFunction<SvelteServerRuntime[\"render\"]>(server, \"render\", \"svelte/server\"),\n createRawSnippet: runtimeFunction<SvelteSharedRuntime[\"createRawSnippet\"]>(\n shared,\n \"createRawSnippet\",\n \"svelte\",\n ),\n };\n}\n\nfunction runtimeFunction<T extends (...args: never[]) => unknown>(\n module: unknown,\n name: string,\n moduleId: string,\n): T {\n const value =\n module && typeof module === \"object\" ? (module as Record<string, unknown>)[name] : undefined;\n if (typeof value !== \"function\") {\n throw new Error(`Svelte HTML host renderer could not load ${moduleId}.${name}.`);\n }\n return value as T;\n}\n","import {\n createHtmlHostHydrate,\n renderHtmlHost,\n type CreateHtmlHostHydrateInput,\n type HtmlHostClientModule,\n type HtmlHostComponentRenderer,\n type HtmlHostDiagnostic,\n type HtmlHostDiagnosticCode,\n type HtmlHostHydrateRenderer,\n type HtmlHostModule,\n type HtmlHostServerModuleLoader,\n type RenderHtmlHostInput,\n} from \"@ox-content/vite-plugin\";\nimport { defaultRenderSvelteHtmlComponent } from \"./html-host-default-renderer\";\nimport type { ComponentsMap } from \"./types\";\n\nexport interface SvelteHtmlHostModule extends HtmlHostModule {}\nexport interface SvelteHtmlHostClientModule extends HtmlHostClientModule {}\nexport type SvelteHtmlHostDiagnosticCode = HtmlHostDiagnosticCode;\nexport interface SvelteHtmlHostDiagnostic extends HtmlHostDiagnostic {}\nexport type SvelteServerModuleLoader = HtmlHostServerModuleLoader;\nexport type SvelteHtmlComponentRenderer = HtmlHostComponentRenderer;\nexport type SvelteClientModuleResolver = (\n module: SvelteHtmlHostModule,\n context: { documentPath: string },\n) => string | undefined;\n\nexport interface RenderSvelteHtmlHostInput extends Omit<\n RenderHtmlHostInput,\n \"components\" | \"frameworkName\" | \"adapter\" | \"renderComponent\" | \"resolveClientModule\"\n> {\n components?: ComponentsMap;\n renderComponent?: SvelteHtmlComponentRenderer;\n resolveClientModule?: SvelteClientModuleResolver;\n}\n\nexport interface RenderSvelteHtmlHostResult {\n html: string;\n modules: SvelteHtmlHostModule[];\n clientModules: SvelteHtmlHostClientModule[];\n diagnostics: SvelteHtmlHostDiagnostic[];\n}\n\nexport type SvelteHostHydrateRenderer = HtmlHostHydrateRenderer;\nexport type CreateSvelteHtmlHostHydrateInput = CreateHtmlHostHydrateInput;\n\nexport async function renderSvelteHtmlHost(\n input: RenderSvelteHtmlHostInput,\n): Promise<RenderSvelteHtmlHostResult> {\n const resolveClientModule: RenderHtmlHostInput[\"resolveClientModule\"] = input.resolveClientModule;\n return (await renderHtmlHost({\n ...input,\n frameworkName: \"Svelte\",\n renderComponent: input.renderComponent ?? defaultRenderSvelteHtmlComponent,\n resolveClientModule,\n })) as RenderSvelteHtmlHostResult;\n}\n\nexport function createSvelteHtmlHostHydrate(\n input: CreateSvelteHtmlHostHydrateInput,\n): (element: HTMLElement, props: Record<string, unknown>) => void | (() => void) {\n return createHtmlHostHydrate(input);\n}\n","import { formatHtmlHostDiagnostics, toHtmlHostClientModuleId } from \"@ox-content/vite-plugin\";\nimport {\n renderSvelteHtmlHost,\n type RenderSvelteHtmlHostResult,\n type SvelteClientModuleResolver,\n type SvelteHtmlComponentRenderer,\n type SvelteHtmlHostDiagnostic,\n type SvelteServerModuleLoader,\n} from \"./html-host\";\nimport { createSvelteHtmlHostComponentRenderer } from \"./html-host-default-renderer\";\nimport type { MdxImport } from \"@ox-content/vite-plugin\";\nimport type { ComponentsMap } from \"./types\";\n\nexport type SvelteHtmlHostRendererDiagnosticPolicy = \"throw\" | \"collect\";\n\nexport interface CreateSvelteHtmlHostRendererInput {\n root?: string;\n srcDir?: string;\n contentRoot?: string;\n components?: ComponentsMap;\n loadModule: SvelteServerModuleLoader;\n renderComponent?: SvelteHtmlComponentRenderer;\n resolveClientModule?: SvelteClientModuleResolver;\n diagnostics?: SvelteHtmlHostRendererDiagnosticPolicy;\n}\n\nexport interface SvelteHtmlHostRendererContext {\n documentPath: string;\n imports?: readonly MdxImport[];\n root?: string;\n srcDir?: string;\n contentRoot?: string;\n components?: ComponentsMap;\n renderComponent?: SvelteHtmlComponentRenderer;\n resolveClientModule?: SvelteClientModuleResolver;\n}\n\nexport type SvelteHtmlHostRenderer = (\n html: string,\n context: SvelteHtmlHostRendererContext,\n) => Promise<RenderSvelteHtmlHostResult>;\n\nexport class SvelteHtmlHostRenderError extends Error {\n readonly diagnostics: SvelteHtmlHostDiagnostic[];\n\n constructor(diagnostics: readonly SvelteHtmlHostDiagnostic[]) {\n super(formatHtmlHostDiagnostics(diagnostics));\n this.name = \"SvelteHtmlHostRenderError\";\n this.diagnostics = [...diagnostics];\n }\n}\n\nexport function createSvelteHtmlHostRenderer(\n input: CreateSvelteHtmlHostRendererInput,\n): SvelteHtmlHostRenderer {\n const policy = input.diagnostics ?? \"throw\";\n const defaultRenderComponent = createSvelteHtmlHostComponentRenderer(input.loadModule);\n\n return async (html, context) => {\n const root = context.root ?? input.root;\n const result = await renderSvelteHtmlHost({\n html,\n documentPath: context.documentPath,\n root,\n srcDir: context.srcDir ?? input.srcDir,\n contentRoot: context.contentRoot ?? input.contentRoot,\n imports: context.imports,\n components: context.components ?? input.components,\n loadModule: input.loadModule,\n renderComponent: context.renderComponent ?? input.renderComponent ?? defaultRenderComponent,\n resolveClientModule:\n context.resolveClientModule ??\n input.resolveClientModule ??\n ((module) => toHtmlHostClientModuleId(module.serverModuleId, root)),\n });\n\n if (policy === \"throw\" && result.diagnostics.length > 0) {\n throw new SvelteHtmlHostRenderError(result.diagnostics);\n }\n\n return result;\n };\n}\n","import {\n createHtmlHostIslandRegistry,\n resolveHtmlHostIslandRegistry,\n toHtmlHostClientModuleId,\n type CreateHtmlHostIslandRegistryInput,\n type HtmlHostIslandDocument,\n type HtmlHostIslandEntry,\n type HtmlHostIslandRegistry,\n type HtmlHostIslandRegistryContext,\n type ResolvedHtmlHostIslandRegistry,\n} from \"@ox-content/vite-plugin\";\n\nexport { toHtmlHostClientModuleId as toSvelteHtmlHostClientModuleId };\n\nexport const SVELTE_HTML_HOST_MODULES_VIRTUAL_ID = \"virtual:ox-content-svelte/html-host/modules\";\n\nexport type SvelteHtmlHostIslandDocument = HtmlHostIslandDocument;\nexport type SvelteHtmlHostIslandEntry = HtmlHostIslandEntry;\nexport type SvelteHtmlHostIslandRegistryContext = HtmlHostIslandRegistryContext;\nexport type CreateSvelteHtmlHostIslandRegistryInput = CreateHtmlHostIslandRegistryInput;\nexport type ResolvedSvelteHtmlHostIslandRegistry = ResolvedHtmlHostIslandRegistry;\nexport type SvelteHtmlHostIslandRegistry = HtmlHostIslandRegistry;\n\nexport function createSvelteHtmlHostIslandRegistry(\n input: CreateSvelteHtmlHostIslandRegistryInput = {},\n): SvelteHtmlHostIslandRegistry {\n return createHtmlHostIslandRegistry({\n ...input,\n virtualModuleId: input.virtualModuleId ?? SVELTE_HTML_HOST_MODULES_VIRTUAL_ID,\n pluginName: input.pluginName ?? \"ox-content:svelte-html-host-island-registry\",\n });\n}\n\nexport function resolveSvelteHtmlHostIslandRegistry(\n input: CreateSvelteHtmlHostIslandRegistryInput,\n context: SvelteHtmlHostIslandRegistryContext,\n resolvedComponents?: Record<string, string>,\n): Promise<ResolvedSvelteHtmlHostIslandRegistry> {\n return resolveHtmlHostIslandRegistry(input, context, resolvedComponents);\n}\n","import {\n resolveHtmlHostCollectionDocuments,\n type HtmlHostCollectionDocument,\n type HtmlHostCollectionDocumentsOptions,\n type HtmlHostIslandRegistryContext,\n} from \"@ox-content/vite-plugin\";\n\nexport type SvelteHtmlHostCollectionDocument = HtmlHostCollectionDocument;\nexport type SvelteHtmlHostCollectionDocumentsOptions = HtmlHostCollectionDocumentsOptions;\n\nexport function createSvelteHtmlHostCollectionDocuments(\n input: SvelteHtmlHostCollectionDocumentsOptions = {},\n): (\n context: HtmlHostIslandRegistryContext,\n) => Promise<readonly SvelteHtmlHostCollectionDocument[]> {\n return (context) => resolveSvelteHtmlHostCollectionDocuments(input, context);\n}\n\nexport function resolveSvelteHtmlHostCollectionDocuments(\n input: SvelteHtmlHostCollectionDocumentsOptions,\n context: HtmlHostIslandRegistryContext,\n): Promise<readonly SvelteHtmlHostCollectionDocument[]> {\n return resolveHtmlHostCollectionDocuments(input, context);\n}\n","/**\n * Vite Plugin for Ox Content Svelte Integration\n *\n * Uses Vite's Environment API to enable embedding Svelte components in Markdown.\n */\n\nimport type { Plugin, PluginOption, ResolvedConfig } from \"vite\";\nimport { oxContent } from \"@ox-content/vite-plugin\";\nimport { transformMarkdownWithSvelte } from \"./transform\";\nimport { createSvelteMarkdownEnvironment } from \"./environment\";\nimport { resolveComponentsGlob } from \"./components\";\nimport type {\n SvelteIntegrationOptions,\n ResolvedSvelteOptions,\n BuiltinEmbedOptions,\n SvelteCompilerWarning,\n} from \"./types\";\n\nconst DEFAULT_MARKDOWN_EXTENSIONS = [\".md\", \".markdown\", \".mdx\"] as const;\n\nfunction normalizeMarkdownExtensions(extensions?: readonly string[]): string[] {\n const values = extensions?.length ? extensions : DEFAULT_MARKDOWN_EXTENSIONS;\n return Array.from(\n new Map(\n values.map((extension) => {\n const value = extension.startsWith(\".\") ? extension : `.${extension}`;\n return [value.toLowerCase(), value] as const;\n }),\n ).values(),\n );\n}\n\nfunction isMarkdownFilePath(filePath: string, extensions: readonly string[]): boolean {\n const pathname = filePath.split(\"?\")[0].split(\"#\")[0].toLowerCase();\n return extensions.some((extension) => pathname.endsWith(extension.toLowerCase()));\n}\n\nfunction resolveBuiltinEmbedOptions(\n options: BuiltinEmbedOptions | false | undefined,\n): ResolvedSvelteOptions[\"embeds\"] {\n if (options === false) return { github: false, openGraph: false };\n return {\n github: resolveSingleEmbedOptions(options?.github),\n openGraph: resolveSingleEmbedOptions(options?.openGraph),\n };\n}\n\nfunction resolveSingleEmbedOptions<T extends object>(options: boolean | T | undefined): T | false {\n if (options === false) return false;\n if (options === true || options === undefined) return {} as T;\n return options;\n}\n\nexport type {\n SvelteIntegrationOptions,\n ResolvedSvelteOptions,\n ComponentsOption,\n ComponentsMap,\n BuiltinEmbedOptions,\n MdxDocumentPropsOption,\n GitHubEmbedOptions,\n OpenGraphEmbedOptions,\n ResolvedBuiltinEmbedOptions,\n SvelteTransformResult,\n SvelteCompilerOption,\n SvelteCompilerWarning,\n SvelteCompilerOptions,\n SvelteCompilerResult,\n SvelteCompileFunction,\n ComponentIsland,\n} from \"./types\";\nexport type {\n MdxImport,\n MdxImportSpecifier,\n MdxImportSpecifierKind,\n} from \"@ox-content/vite-plugin\";\nexport {\n createSvelteHtmlHostHydrate,\n renderSvelteHtmlHost,\n type CreateSvelteHtmlHostHydrateInput,\n type RenderSvelteHtmlHostInput,\n type RenderSvelteHtmlHostResult,\n type SvelteClientModuleResolver,\n type SvelteHostHydrateRenderer,\n type SvelteHtmlComponentRenderer,\n type SvelteHtmlHostClientModule,\n type SvelteHtmlHostDiagnostic,\n type SvelteHtmlHostDiagnosticCode,\n type SvelteHtmlHostModule,\n type SvelteServerModuleLoader,\n} from \"./html-host\";\nexport {\n SvelteHtmlHostRenderError,\n createSvelteHtmlHostRenderer,\n type CreateSvelteHtmlHostRendererInput,\n type SvelteHtmlHostRenderer,\n type SvelteHtmlHostRendererContext,\n type SvelteHtmlHostRendererDiagnosticPolicy,\n} from \"./html-host-renderer\";\nexport {\n createSvelteHtmlHostDomRenderer,\n createSvelteHtmlHostLazyHydrate,\n initSvelteHtmlHost,\n loadSvelteHtmlHostDomRuntime,\n readSvelteHtmlHostSlot,\n type CreateSvelteHtmlHostLazyHydrateInput,\n type InitSvelteHtmlHostInput,\n type SvelteHtmlHostClientComponentValue,\n type SvelteHtmlHostClientContext,\n type SvelteHtmlHostClientDiagnosticCode,\n type SvelteHtmlHostClientError,\n type SvelteHtmlHostClientModuleLoader,\n type SvelteHtmlHostClientModules,\n type SvelteHtmlHostClientModuleValue,\n type SvelteHtmlHostClientRenderer,\n type SvelteHtmlHostClientRuntimeLoader,\n type SvelteHtmlHostDomMode,\n type SvelteHtmlHostDomRenderer,\n type SvelteHtmlHostDomRendererInput,\n type SvelteHtmlHostDomRuntime,\n type SvelteHtmlHostExportNameResolver,\n type SvelteHtmlHostInitIslands,\n type SvelteHtmlHostModuleIdResolver,\n} from \"./html-host-client\";\nexport {\n SVELTE_HTML_HOST_MODULES_VIRTUAL_ID,\n createSvelteHtmlHostIslandRegistry,\n resolveSvelteHtmlHostIslandRegistry,\n toSvelteHtmlHostClientModuleId,\n type CreateSvelteHtmlHostIslandRegistryInput,\n type ResolvedSvelteHtmlHostIslandRegistry,\n type SvelteHtmlHostIslandDocument,\n type SvelteHtmlHostIslandEntry,\n type SvelteHtmlHostIslandRegistry,\n type SvelteHtmlHostIslandRegistryContext,\n} from \"./html-host-registry\";\nexport {\n createSvelteHtmlHostCollectionDocuments,\n resolveSvelteHtmlHostCollectionDocuments,\n type SvelteHtmlHostCollectionDocument,\n type SvelteHtmlHostCollectionDocumentsOptions,\n} from \"./html-host-collection-documents\";\n\n/**\n * Creates the Ox Content Svelte integration plugin.\n *\n * Forwards core options such as `ssg`, `redirects`, `feeds`, and `siteMaps`.\n * The Svelte Markdown transform and environments replace the generic core\n * transform/`markdown` environment; other build plugins are kept.\n *\n * @example\n * ```ts\n * // vite.config.ts\n * import { defineConfig } from 'vite';\n * import { svelte } from '@sveltejs/vite-plugin-svelte';\n * import { oxContentSvelte } from 'vite-plugin-ox-content-svelte';\n *\n * export default defineConfig({\n * plugins: [\n * svelte(),\n * oxContentSvelte({\n * srcDir: 'docs',\n * components: {\n * Counter: './src/components/Counter.svelte',\n * },\n * }),\n * ],\n * });\n * ```\n */\nexport function oxContentSvelte(options: SvelteIntegrationOptions = {}): PluginOption[] {\n const resolved = resolveSvelteOptions(options);\n let componentMap = new Map<string, string>();\n let config: ResolvedConfig;\n\n if (typeof options.components === \"object\" && !Array.isArray(options.components)) {\n componentMap = new Map(Object.entries(options.components));\n }\n\n const svelteTransformPlugin: Plugin = {\n name: \"ox-content:svelte-transform\",\n enforce: \"pre\",\n\n async configResolved(resolvedConfig) {\n config = resolvedConfig;\n\n const componentsOption = options.components;\n if (componentsOption) {\n const resolvedComponents = await resolveComponentsGlob(componentsOption, config.root);\n componentMap = new Map(Object.entries(resolvedComponents));\n }\n },\n\n async transform(code, id, transformOptions) {\n if (!isMarkdownFilePath(id, resolved.extensions)) {\n return null;\n }\n\n const result = await transformMarkdownWithSvelte(code, id, {\n ...resolved,\n components: Object.fromEntries(componentMap),\n root: config.root,\n renderIsland: options.renderIsland,\n ssr: transformOptions?.ssr,\n });\n\n for (const warning of result.warnings) {\n this.warn(formatSvelteCompilerWarning(warning));\n }\n\n return {\n code: result.code,\n map: result.map as never,\n };\n },\n };\n\n const svelteEnvironmentPlugin: Plugin = {\n name: \"ox-content:svelte-environment\",\n\n config() {\n return {\n environments: {\n oxcontent_ssr: createSvelteMarkdownEnvironment(\"ssr\", resolved),\n oxcontent_client: createSvelteMarkdownEnvironment(\"client\", resolved),\n },\n };\n },\n\n resolveId(id) {\n if (id === \"virtual:ox-content-svelte/runtime\") {\n return \"\\0virtual:ox-content-svelte/runtime\";\n }\n if (id === \"virtual:ox-content-svelte/components\") {\n return \"\\0virtual:ox-content-svelte/components\";\n }\n return null;\n },\n\n load(id) {\n if (id === \"\\0virtual:ox-content-svelte/runtime\") {\n return generateRuntimeModule();\n }\n if (id === \"\\0virtual:ox-content-svelte/components\") {\n return generateComponentsModule(componentMap);\n }\n return null;\n },\n\n applyToEnvironment(environment) {\n return [\"oxcontent_ssr\", \"oxcontent_client\", \"client\", \"ssr\"].includes(environment.name);\n },\n };\n\n const svelteHmrPlugin: Plugin = {\n name: \"ox-content:svelte-hmr\",\n apply: \"serve\",\n\n handleHotUpdate({ file, server, modules }) {\n const isComponent = Array.from(componentMap.values()).some((path) =>\n file.endsWith(path.replace(/^\\.\\//, \"\")),\n );\n\n if (isComponent) {\n const mdModules = Array.from(server.moduleGraph.idToModuleMap.values()).filter(\n (mod) => mod.file && isMarkdownFilePath(mod.file, resolved.extensions),\n );\n\n if (mdModules.length > 0) {\n server.ws.send({\n type: \"custom\",\n event: \"ox-content:svelte-update\",\n data: { file },\n });\n return [...modules, ...mdModules];\n }\n }\n\n return modules;\n },\n };\n\n const replacedCorePluginNames = new Set([\"ox-content\", \"ox-content:environment\"]);\n const corePlugins = (\n oxContent(options).flatMap((plugin) => (Array.isArray(plugin) ? plugin : [plugin])) as Plugin[]\n ).filter((plugin) => !replacedCorePluginNames.has(plugin.name));\n\n return [svelteTransformPlugin, svelteEnvironmentPlugin, svelteHmrPlugin, ...corePlugins];\n}\n\nfunction resolveSvelteOptions(\n options: SvelteIntegrationOptions,\n): Omit<ResolvedSvelteOptions, \"components\"> {\n return {\n srcDir: options.srcDir ?? \"docs\",\n outDir: options.outDir ?? \"dist\",\n base: options.base ?? \"/\",\n extensions: normalizeMarkdownExtensions(options.extensions),\n gfm: options.gfm ?? true,\n autolinks: options.autolinks ?? options.gfm ?? true,\n frontmatter: options.frontmatter ?? true,\n toc: options.toc ?? true,\n tocMaxDepth: options.tocMaxDepth ?? 3,\n codeAnnotations: resolveCodeAnnotationsOptions(options.codeAnnotations),\n runes: options.runes ?? true,\n compiler: options.compiler,\n embeds: resolveBuiltinEmbedOptions(options.embeds),\n mdx: options.mdx,\n mdxDocumentProps: options.mdxDocumentProps ?? false,\n };\n}\n\nfunction formatSvelteCompilerWarning(warning: SvelteCompilerWarning): string {\n const code = warning.code ? `[${warning.code}] ` : \"\";\n const message = `${code}${warning.message}`;\n return warning.frame ? `${message}\\n${warning.frame}` : message;\n}\n\nfunction resolveCodeAnnotationsOptions(\n options: SvelteIntegrationOptions[\"codeAnnotations\"],\n): ResolvedSvelteOptions[\"codeAnnotations\"] {\n if (!options) {\n return {\n enabled: false,\n metaKey: \"annotate\",\n };\n }\n\n if (options === true) {\n return {\n enabled: true,\n metaKey: \"annotate\",\n };\n }\n\n return {\n enabled: true,\n metaKey: options.metaKey ?? \"annotate\",\n };\n}\n\nfunction generateRuntimeModule(): string {\n return `\n// Svelte 5 runtime for ox-content\nexport { mount, unmount } from 'svelte';\n`;\n}\n\nfunction generateComponentsModule(componentMap: Map<string, string>): string {\n const imports: string[] = [];\n const exports: string[] = [];\n\n componentMap.forEach((path, name) => {\n imports.push(`import ${name} from '${path}';`);\n exports.push(` ${name},`);\n });\n\n return `\n${imports.join(\"\\n\")}\n\nexport const components = {\n${exports.join(\"\\n\")}\n};\n\nexport default components;\n`;\n}\n\nexport { oxContent, renderHead } from \"@ox-content/vite-plugin\";\nexport type { HeadInput, RenderedHead } from \"@ox-content/vite-plugin\";\n"],"mappings":";;;;;;AAqBA,MAAM,kBAAkB;AACxB,MAAM,aAAa;AAEnB,MAAM,uBAAuB;AAC7B,MAAM,uBAAuB;AAC7B,MAAM,8BAA8B;AACpC,MAAM,8BAA8B;AACpC,MAAM,iBAAiB;AACvB,MAAM,oCAAoB,IAAI,IAAI;CAAC;CAAS;CAAe;AAAS,CAAC;AAOrE,eAAsB,4BACpB,MACA,IACA,SACgC;CAChC,MAAM,aAA4B,QAAQ;CAC1C,MAAM,EAAE,SAAS,iBAAiB,gBAAgB,mBAAmB,IAAI;CACzE,MAAM,MAAM,sBAAsB,IAAI,QAAQ,GAAG;CAEjD,MAAM,cAAc;EAClB,QAAQ,QAAQ;EAChB,QAAQ,QAAQ;EAChB,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AG;EAC7C,QAAQ,KAAK,KAAK,KAAK,EAAE;CAC3B,CAAC;CAED,OAAO;EACP,QAAQ,KAAK,IAAI,EAAE;;;EAGnB,QAAQ,KAAK,IAAI,EAAE;;;;;AAKrB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ox-content/vite-plugin-svelte",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.4",
|
|
4
4
|
"description": "Svelte integration for Ox Content - Embed Svelte components in Markdown",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markdown",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"provenance": true
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@ox-content/islands": "3.1.
|
|
48
|
-
"@ox-content/vite-plugin": "3.1.
|
|
47
|
+
"@ox-content/islands": "3.1.4",
|
|
48
|
+
"@ox-content/vite-plugin": "3.1.4"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@rsvelte/vite-plugin-svelte": "^0.5.2",
|