@ox-content/vite-plugin-svelte 3.0.0-alpha.4 → 3.0.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +6 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -617,3 +617,9 @@ Object.defineProperty(exports, "oxContent", {
|
|
|
617
617
|
}
|
|
618
618
|
});
|
|
619
619
|
exports.oxContentSvelte = oxContentSvelte;
|
|
620
|
+
Object.defineProperty(exports, "renderHead", {
|
|
621
|
+
enumerable: true,
|
|
622
|
+
get: function() {
|
|
623
|
+
return _ox_content_vite_plugin.renderHead;
|
|
624
|
+
}
|
|
625
|
+
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PluginOption } from "vite";
|
|
2
|
-
import { OxContentOptions, RenderIslandFn, oxContent } from "@ox-content/vite-plugin";
|
|
2
|
+
import { HeadInput, OxContentOptions, RenderIslandFn, RenderedHead, oxContent, renderHead } from "@ox-content/vite-plugin";
|
|
3
3
|
//#region src/types.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Code annotation options for the Svelte integration.
|
|
@@ -230,5 +230,5 @@ interface ComponentIsland {
|
|
|
230
230
|
*/
|
|
231
231
|
declare function oxContentSvelte(options?: SvelteIntegrationOptions): PluginOption[];
|
|
232
232
|
//#endregion
|
|
233
|
-
export { type BuiltinEmbedOptions, type ComponentIsland, type ComponentsMap, type ComponentsOption, type GitHubEmbedOptions, type OpenGraphEmbedOptions, type ResolvedBuiltinEmbedOptions, type ResolvedSvelteOptions, type SvelteIntegrationOptions, type SvelteTransformResult, oxContent, oxContentSvelte };
|
|
233
|
+
export { type BuiltinEmbedOptions, type ComponentIsland, type ComponentsMap, type ComponentsOption, type GitHubEmbedOptions, type HeadInput, type OpenGraphEmbedOptions, type RenderedHead, type ResolvedBuiltinEmbedOptions, type ResolvedSvelteOptions, type SvelteIntegrationOptions, type SvelteTransformResult, oxContent, oxContentSvelte, renderHead };
|
|
234
234
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OxContentOptions, RenderIslandFn, oxContent } from "@ox-content/vite-plugin";
|
|
1
|
+
import { HeadInput, OxContentOptions, RenderIslandFn, RenderedHead, oxContent, renderHead } from "@ox-content/vite-plugin";
|
|
2
2
|
import { PluginOption } from "vite";
|
|
3
3
|
//#region src/types.d.ts
|
|
4
4
|
/**
|
|
@@ -230,5 +230,5 @@ interface ComponentIsland {
|
|
|
230
230
|
*/
|
|
231
231
|
declare function oxContentSvelte(options?: SvelteIntegrationOptions): PluginOption[];
|
|
232
232
|
//#endregion
|
|
233
|
-
export { type BuiltinEmbedOptions, type ComponentIsland, type ComponentsMap, type ComponentsOption, type GitHubEmbedOptions, type OpenGraphEmbedOptions, type ResolvedBuiltinEmbedOptions, type ResolvedSvelteOptions, type SvelteIntegrationOptions, type SvelteTransformResult, oxContent, oxContentSvelte };
|
|
233
|
+
export { type BuiltinEmbedOptions, type ComponentIsland, type ComponentsMap, type ComponentsOption, type GitHubEmbedOptions, type HeadInput, type OpenGraphEmbedOptions, type RenderedHead, type ResolvedBuiltinEmbedOptions, type ResolvedSvelteOptions, type SvelteIntegrationOptions, type SvelteTransformResult, oxContent, oxContentSvelte, renderHead };
|
|
234
234
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as fs from "fs";
|
|
2
2
|
import * as path from "path";
|
|
3
|
-
import { applyIslandSsrHtml, discoverDocumentMdxIslands, oxContent, oxContent as oxContent$1, renderIslandComponentImports, resolveContentRootPath, resolveMdxForFilePath, transformMarkdown } from "@ox-content/vite-plugin";
|
|
3
|
+
import { applyIslandSsrHtml, discoverDocumentMdxIslands, oxContent, oxContent as oxContent$1, renderHead, renderIslandComponentImports, resolveContentRootPath, resolveMdxForFilePath, transformMarkdown } from "@ox-content/vite-plugin";
|
|
4
4
|
import { compile } from "svelte/compiler";
|
|
5
5
|
//#region src/transform.ts
|
|
6
6
|
const COMPONENT_REGEX = /<([A-Z][a-zA-Z0-9]*)\s*([^>]*?)\s*(?:\/>|>([\s\S]*?)<\/\1>)/g;
|
|
@@ -585,6 +585,6 @@ function toPascalCase(str) {
|
|
|
585
585
|
return str.replace(/[-_](\w)/g, (_, c) => c.toUpperCase()).replace(/^\w/, (c) => c.toUpperCase());
|
|
586
586
|
}
|
|
587
587
|
//#endregion
|
|
588
|
-
export { oxContent, oxContentSvelte };
|
|
588
|
+
export { oxContent, oxContentSvelte, renderHead };
|
|
589
589
|
|
|
590
590
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["baseTransformMarkdown","oxContent"],"sources":["../src/transform.ts","../src/environment.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 } from \"svelte/compiler\";\nimport type {\n ResolvedSvelteOptions,\n SvelteTransformResult,\n ComponentIsland,\n ComponentsMap,\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\";\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 transformed = await baseTransformMarkdown(markdownContent, 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 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 );\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 );\n}\n\nfunction compileSvelteResult(\n svelteCode: string,\n id: string,\n usedComponents: string[],\n frontmatter: Record<string, unknown>,\n): SvelteTransformResult {\n const compiled = compile(svelteCode, {\n filename: id,\n generate: \"client\",\n runes: true,\n });\n\n return {\n code: `${compiled.js.code}\\nexport const frontmatter = ${JSON.stringify(frontmatter)};`,\n map: null,\n usedComponents,\n frontmatter,\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\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, onMount, mount, 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 instance = mount(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 * Vite Plugin for Ox Content Svelte Integration\n *\n * Uses Vite's Environment API to enable embedding Svelte components in Markdown.\n */\n\nimport * as fs from \"fs\";\nimport * as path from \"path\";\nimport type { Plugin, PluginOption, ResolvedConfig } from \"vite\";\nimport { oxContent } from \"@ox-content/vite-plugin\";\nimport { transformMarkdownWithSvelte } from \"./transform\";\nimport { createSvelteMarkdownEnvironment } from \"./environment\";\nimport type {\n SvelteIntegrationOptions,\n ResolvedSvelteOptions,\n ComponentsMap,\n ComponentsOption,\n BuiltinEmbedOptions,\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 GitHubEmbedOptions,\n OpenGraphEmbedOptions,\n ResolvedBuiltinEmbedOptions,\n SvelteTransformResult,\n ComponentIsland,\n} from \"./types\";\n\n/**\n * Creates the Ox Content Svelte integration plugin.\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) {\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 });\n\n return {\n code: result.code,\n map: result.map,\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 basePlugins = oxContent(options).flatMap((plugin) =>\n Array.isArray(plugin) ? plugin : [plugin],\n ) as Plugin[];\n const environmentPlugin = basePlugins.find((plugin) => plugin.name === \"ox-content:environment\");\n const plugins: Plugin[] = [svelteTransformPlugin, svelteEnvironmentPlugin, svelteHmrPlugin];\n\n if (environmentPlugin) {\n plugins.push(environmentPlugin);\n }\n\n return plugins;\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 embeds: resolveBuiltinEmbedOptions(options.embeds),\n mdx: options.mdx,\n };\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\nasync 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\n const result: ComponentsMap = {};\n\n for (const pattern of patterns) {\n const files = await globFiles(pattern, root);\n\n for (const file of files) {\n const baseName = path.basename(file, path.extname(file));\n const componentName = toPascalCase(baseName);\n const relativePath = \"./\" + path.relative(root, file).replace(/\\\\/g, \"/\");\n\n result[componentName] = relativePath;\n }\n }\n\n return result;\n}\n\nasync function globFiles(pattern: string, root: string): Promise<string[]> {\n const files: string[] = [];\n const isGlob = pattern.includes(\"*\");\n\n if (!isGlob) {\n const fullPath = path.resolve(root, pattern);\n if (fs.existsSync(fullPath)) {\n files.push(fullPath);\n }\n return files;\n }\n\n const parts = pattern.split(\"*\");\n const baseDir = path.resolve(root, parts[0]);\n const ext = parts[1] || \"\";\n\n if (!fs.existsSync(baseDir)) {\n return files;\n }\n\n if (pattern.includes(\"**\")) {\n await walkDir(baseDir, files, ext);\n } else {\n const entries = await fs.promises.readdir(baseDir, { withFileTypes: true });\n for (const entry of entries) {\n if (entry.isFile() && entry.name.endsWith(ext)) {\n files.push(path.join(baseDir, entry.name));\n }\n }\n }\n\n return files;\n}\n\nasync function walkDir(dir: string, files: string[], ext: 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, ext);\n } else if (entry.isFile() && entry.name.endsWith(ext)) {\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\nexport { oxContent } from \"@ox-content/vite-plugin\";\n"],"mappings":";;;;;AAiBA,MAAM,kBAAkB;AACxB,MAAM,aAAa;AAEnB,MAAM,uBAAuB;AAC7B,MAAM,uBAAuB;AAO7B,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,MAAM,QAAQ;EACd,YAAY,QAAQ;EACpB;EACA,KAAK;GACH,SAAS;GACT,WAAW;GACX,OAAO;GACP,MAAM;GACN,iBAAiB;GACjB,aAAa;GACb,YAAY;GACZ,aAAa;GACb,QAAQ;GACR,cAAc;GACd,gBAAgB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A4B;CAC/E,MAAM,UAAU,MAAM,GAAG,SAAS,QAAQ,KAAK,EAAE,eAAe,KAAK,CAAC;CAEtE,KAAK,MAAM,SAAS,SAAS;EAC3B,MAAM,WAAW,KAAK,KAAK,KAAK,MAAM,IAAI;EAE1C,IAAI,MAAM,YAAY,GACpB,MAAM,QAAQ,UAAU,OAAO,GAAG;OAC7B,IAAI,MAAM,OAAO,KAAK,MAAM,KAAK,SAAS,GAAG,GAClD,MAAM,KAAK,QAAQ;CAEvB;AACF;AAEA,SAAS,aAAa,KAAqB;CACzC,OAAO,IAAI,QAAQ,cAAc,GAAG,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,QAAQ,QAAQ,MAAM,EAAE,YAAY,CAAC;AAClG"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["baseTransformMarkdown","oxContent"],"sources":["../src/transform.ts","../src/environment.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 } from \"svelte/compiler\";\nimport type {\n ResolvedSvelteOptions,\n SvelteTransformResult,\n ComponentIsland,\n ComponentsMap,\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\";\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 transformed = await baseTransformMarkdown(markdownContent, 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 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 );\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 );\n}\n\nfunction compileSvelteResult(\n svelteCode: string,\n id: string,\n usedComponents: string[],\n frontmatter: Record<string, unknown>,\n): SvelteTransformResult {\n const compiled = compile(svelteCode, {\n filename: id,\n generate: \"client\",\n runes: true,\n });\n\n return {\n code: `${compiled.js.code}\\nexport const frontmatter = ${JSON.stringify(frontmatter)};`,\n map: null,\n usedComponents,\n frontmatter,\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\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, onMount, mount, 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 instance = mount(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 * Vite Plugin for Ox Content Svelte Integration\n *\n * Uses Vite's Environment API to enable embedding Svelte components in Markdown.\n */\n\nimport * as fs from \"fs\";\nimport * as path from \"path\";\nimport type { Plugin, PluginOption, ResolvedConfig } from \"vite\";\nimport { oxContent } from \"@ox-content/vite-plugin\";\nimport { transformMarkdownWithSvelte } from \"./transform\";\nimport { createSvelteMarkdownEnvironment } from \"./environment\";\nimport type {\n SvelteIntegrationOptions,\n ResolvedSvelteOptions,\n ComponentsMap,\n ComponentsOption,\n BuiltinEmbedOptions,\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 GitHubEmbedOptions,\n OpenGraphEmbedOptions,\n ResolvedBuiltinEmbedOptions,\n SvelteTransformResult,\n ComponentIsland,\n} from \"./types\";\n\n/**\n * Creates the Ox Content Svelte integration plugin.\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) {\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 });\n\n return {\n code: result.code,\n map: result.map,\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 basePlugins = oxContent(options).flatMap((plugin) =>\n Array.isArray(plugin) ? plugin : [plugin],\n ) as Plugin[];\n const environmentPlugin = basePlugins.find((plugin) => plugin.name === \"ox-content:environment\");\n const plugins: Plugin[] = [svelteTransformPlugin, svelteEnvironmentPlugin, svelteHmrPlugin];\n\n if (environmentPlugin) {\n plugins.push(environmentPlugin);\n }\n\n return plugins;\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 embeds: resolveBuiltinEmbedOptions(options.embeds),\n mdx: options.mdx,\n };\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\nasync 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\n const result: ComponentsMap = {};\n\n for (const pattern of patterns) {\n const files = await globFiles(pattern, root);\n\n for (const file of files) {\n const baseName = path.basename(file, path.extname(file));\n const componentName = toPascalCase(baseName);\n const relativePath = \"./\" + path.relative(root, file).replace(/\\\\/g, \"/\");\n\n result[componentName] = relativePath;\n }\n }\n\n return result;\n}\n\nasync function globFiles(pattern: string, root: string): Promise<string[]> {\n const files: string[] = [];\n const isGlob = pattern.includes(\"*\");\n\n if (!isGlob) {\n const fullPath = path.resolve(root, pattern);\n if (fs.existsSync(fullPath)) {\n files.push(fullPath);\n }\n return files;\n }\n\n const parts = pattern.split(\"*\");\n const baseDir = path.resolve(root, parts[0]);\n const ext = parts[1] || \"\";\n\n if (!fs.existsSync(baseDir)) {\n return files;\n }\n\n if (pattern.includes(\"**\")) {\n await walkDir(baseDir, files, ext);\n } else {\n const entries = await fs.promises.readdir(baseDir, { withFileTypes: true });\n for (const entry of entries) {\n if (entry.isFile() && entry.name.endsWith(ext)) {\n files.push(path.join(baseDir, entry.name));\n }\n }\n }\n\n return files;\n}\n\nasync function walkDir(dir: string, files: string[], ext: 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, ext);\n } else if (entry.isFile() && entry.name.endsWith(ext)) {\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\nexport { oxContent, renderHead } from \"@ox-content/vite-plugin\";\nexport type { HeadInput, RenderedHead } from \"@ox-content/vite-plugin\";\n"],"mappings":";;;;;AAiBA,MAAM,kBAAkB;AACxB,MAAM,aAAa;AAEnB,MAAM,uBAAuB;AAC7B,MAAM,uBAAuB;AAO7B,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,MAAM,QAAQ;EACd,YAAY,QAAQ;EACpB;EACA,KAAK;GACH,SAAS;GACT,WAAW;GACX,OAAO;GACP,MAAM;GACN,iBAAiB;GACjB,aAAa;GACb,YAAY;GACZ,aAAa;GACb,QAAQ;GACR,cAAc;GACd,gBAAgB;GAChB,MAAM;GACN,YAAY;EACd;EACA,KAAK,QAAQ;EACb,aAAa;EACb,KAAK,QAAQ;EACb,a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EtE,KAAK,MAAM,SAAS,SAAS;EAC3B,MAAM,WAAW,KAAK,KAAK,KAAK,MAAM,IAAI;EAE1C,IAAI,MAAM,YAAY,GACpB,MAAM,QAAQ,UAAU,OAAO,GAAG;OAC7B,IAAI,MAAM,OAAO,KAAK,MAAM,KAAK,SAAS,GAAG,GAClD,MAAM,KAAK,QAAQ;CAEvB;AACF;AAEA,SAAS,aAAa,KAAqB;CACzC,OAAO,IAAI,QAAQ,cAAc,GAAG,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,QAAQ,QAAQ,MAAM,EAAE,YAAY,CAAC;AAClG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ox-content/vite-plugin-svelte",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.5",
|
|
4
4
|
"description": "Svelte integration for Ox Content - Embed Svelte components in Markdown",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markdown",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"provenance": true
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@ox-content/islands": "3.0.0-alpha.
|
|
38
|
-
"@ox-content/vite-plugin": "3.0.0-alpha.
|
|
37
|
+
"@ox-content/islands": "3.0.0-alpha.5",
|
|
38
|
+
"@ox-content/vite-plugin": "3.0.0-alpha.5"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@sveltejs/vite-plugin-svelte": "^7.2.0",
|