@ox-content/vite-plugin-svelte 3.2.0 → 3.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1101,21 +1101,10 @@ function toPascalCase(str) {
1101
1101
  const defaultRenderSvelteHtmlComponent = async (component, props, slotHtml) => {
1102
1102
  return renderWithSvelteRuntime(await loadDefaultSvelteRuntime(), component, props, slotHtml);
1103
1103
  };
1104
- function createSvelteHtmlHostComponentRenderer(loadModule) {
1105
- let pending;
1106
- return async (component, props, slotHtml) => {
1107
- pending ??= loadSvelteRuntimeFromHost(loadModule);
1108
- return renderWithSvelteRuntime(await pending, component, props, slotHtml);
1109
- };
1110
- }
1111
1104
  async function loadDefaultSvelteRuntime() {
1112
1105
  const [server, shared] = await Promise.all([import("svelte/server"), import("svelte")]);
1113
1106
  return resolveSvelteRuntime(server, shared);
1114
1107
  }
1115
- async function loadSvelteRuntimeFromHost(loadModule) {
1116
- const [server, shared] = await Promise.all([loadModule("svelte/server"), loadModule("svelte")]);
1117
- return resolveSvelteRuntime(server, shared);
1118
- }
1119
1108
  function renderWithSvelteRuntime(runtime, component, props, slotHtml) {
1120
1109
  const componentProps = slotHtml ? {
1121
1110
  ...props,
@@ -1164,7 +1153,6 @@ var SvelteHtmlHostRenderError = class extends Error {
1164
1153
  };
1165
1154
  function createSvelteHtmlHostRenderer(input) {
1166
1155
  const policy = input.diagnostics ?? "throw";
1167
- const defaultRenderComponent = createSvelteHtmlHostComponentRenderer(input.loadModule);
1168
1156
  return async (html, context) => {
1169
1157
  const root = context.root ?? input.root;
1170
1158
  const result = await renderSvelteHtmlHost({
@@ -1176,7 +1164,7 @@ function createSvelteHtmlHostRenderer(input) {
1176
1164
  imports: context.imports,
1177
1165
  components: context.components ?? input.components,
1178
1166
  loadModule: input.loadModule,
1179
- renderComponent: context.renderComponent ?? input.renderComponent ?? defaultRenderComponent,
1167
+ renderComponent: context.renderComponent ?? input.renderComponent,
1180
1168
  resolveClientModule: context.resolveClientModule ?? input.resolveClientModule ?? ((module) => (0, _ox_content_vite_plugin.toHtmlHostClientModuleId)(module.serverModuleId, root))
1181
1169
  });
1182
1170
  if (policy === "throw" && result.diagnostics.length > 0) throw new SvelteHtmlHostRenderError(result.diagnostics);
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/html-host.ts","../src/html-host-renderer.ts","../src/html-host-registry.ts","../src/html-host-collection-documents.ts","../src/index.ts"],"mappings":";;;;;;;;;;;UASiB;;;;;;EAMf;;UAGe;EACf;EACA;;;;;KAMU,gBAAgB;;;;;;;;KAShB,mBAAmB;KAEnB,wBAAwB;UAEnB,8BAA8B,KAC7C;EAGA;EACA;EACA;;UAGe;EACf;EACA;;UAGe;EACf,IAAI;EACJ,oBAAoB;;KAGV,uBAAuB;KAEvB,yBACV,gBACA,SAAS,0BACN,uBAAuB,QAAQ;KAExB,uBACR;EAEE,SAAS;;;;;;;;;KAUH;;;;;;;;UASK,iCAAiC;;;;;;;;EAQhD;;;;;;;;;;;;;;;;;;EAmBA,aAAa;;;;;;;;EASb,4BAA4B;;;;;;;;;EAU5B;;;;;;;;;;EAWA,WAAW;;;;;;;;;EAUX,SAAS;;;;;;;EAQT,eAAe;;;;;;;;;;;;EAaf,mBAAmB;;;;;UAMJ;;;;;EAKf;;;;;EAMA;;;;;EAMA;;;;;EAMA;;;;;EAMA;;;;;UAMe;;;;;EAKf;;;;;EAMA;;;;;EAMA;;;;;EAMA;;;;;UAMe;;;;;EAKf,mBAAmB;;;;;EAMnB,sBAAsB;;UAGP;EACf,QAAQ;EACR,WAAW;;UAGI;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,iBAAiB;EACjB,YAAY;EACZ;EACA,WAAW;EACX,QAAQ;EACR;EACA;EACA,eAAe;EACf;EACA;;UAGe;EACf;EACA;EACA,UAAU;EACV;EACA,aAAa;;UAGE;EACf;EACA,OAAO;EACP;EACA;EACA;;;;UC1Re,6BAA6B;UAC7B,mCAAmC;KACxC,+BAA+B;UAC1B,iCAAiC;KACtC,2BAA2B;KAC3B,8BAA8B;KAC9B,8BACV,QAAQ,sBACR;EAAW;;UAGI,kCAAkC,KACjD;EAGA,aAAa;EACb,kBAAkB;EAClB,sBAAsB;;UAGP;EACf;EACA;EACA,mBAAmB;EACnB,SAAS;EACT,eAAe;EACf,aAAa;;UAEE,uCAAuC;KAE5C,4BAA4B;KAC5B,mCAAmC;iBAEzB,qBACpB,OAAO,4BACN,QAAQ;iBAUK,4BACd,OAAO,oCACL,SAAS,aAAa,OAAO;;;KCnDrB;UAEK;EACf;EACA;EACA;EACA,aAAa;EACb,YAAY;EACZ,kBAAkB;EAClB,sBAAsB;EACtB,cAAc;;UAGC;EACf;EACA,mBAAmB;EACnB;EACA;EACA;EACA,aAAa;EACb,kBAAkB;EAClB,sBAAsB;;KAGZ,0BACV,cACA,SAAS,kCACN,QAAQ;cAEA,kCAAkC;WACpC,aAAa;EAEtB,YAAY,sBAAsB;;iBAOpB,6BACd,OAAO,oCACN;;;cCxCU;KAED,+BAA+B;KAC/B,4BAA4B;KAC5B,sCAAsC;KACtC,0CAA0C;KAC1C,uCAAuC;KACvC,+BAA+B;iBAE3B,mCACd,QAAO,0CACN;iBAQa,oCACd,OAAO,yCACP,SAAS,qCACT,qBAAqB,yBACpB,QAAQ;;;KC9BC,mCAAmC;KACnC,2CAA2C;iBAEvC,wCACd,QAAO,4CAEP,SAAS,kCACN,iBAAiB;iBAIN,yCACd,OAAO,0CACP,SAAS,gCACR,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBCsJJ,gBAAgB,UAAS,2BAAgC"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/html-host.ts","../src/html-host-renderer.ts","../src/html-host-registry.ts","../src/html-host-collection-documents.ts","../src/index.ts"],"mappings":";;;;;;;;;;;UASiB;;;;;;EAMf;;UAGe;EACf;EACA;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AAa,OAAO;;;KCpDrB;UAEK;EACf;EACA;EACA;EACA,aAAa;EACb,YAAY;EACZ,kBAAkB;EAClB,sBAAsB;EACtB,cAAc;;UAGC;EACf;EACA,mBAAmB;EACnB;EACA;EACA;EACA,aAAa;EACb,kBAAkB;EAClB,sBAAsB;;KAGZ,0BACV,cACA,SAAS,kCACN,QAAQ;cAEA,kCAAkC;WACpC,aAAa;EAEtB,YAAY,sBAAsB;;iBAOpB,6BACd,OAAO,oCACN;;;cCvCU;KAED,+BAA+B;KAC/B,4BAA4B;KAC5B,sCAAsC;KACtC,0CAA0C;KAC1C,uCAAuC;KACvC,+BAA+B;iBAE3B,mCACd,QAAO,0CACN;iBAQa,oCACd,OAAO,yCACP,SAAS,qCACT,qBAAqB,yBACpB,QAAQ;;;KC9BC,mCAAmC;KACnC,2CAA2C;iBAEvC,wCACd,QAAO,4CAEP,SAAS,kCACN,iBAAiB;iBAIN,yCACd,OAAO,0CACP,SAAS,gCACR,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBCsJJ,gBAAgB,UAAS,2BAAgC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/html-host.ts","../src/html-host-renderer.ts","../src/html-host-registry.ts","../src/html-host-collection-documents.ts","../src/index.ts"],"mappings":";;;;;;;;;;;UASiB;;;;;;EAMf;;UAGe;EACf;EACA;;;;;KAMU,gBAAgB;;;;;;;;KAShB,mBAAmB;KAEnB,wBAAwB;UAEnB,8BAA8B,KAC7C;EAGA;EACA;EACA;;UAGe;EACf;EACA;;UAGe;EACf,IAAI;EACJ,oBAAoB;;KAGV,uBAAuB;KAEvB,yBACV,gBACA,SAAS,0BACN,uBAAuB,QAAQ;KAExB,uBACR;EAEE,SAAS;;;;;;;;;KAUH;;;;;;;;UASK,iCAAiC;;;;;;;;EAQhD;;;;;;;;;;;;;;;;;;EAmBA,aAAa;;;;;;;;EASb,4BAA4B;;;;;;;;;EAU5B;;;;;;;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C;KAC1C,uCAAuC;KACvC,+BAA+B;iBAE3B,mCACd,QAAO,0CACN;iBAQa,oCACd,OAAO,yCACP,SAAS,qCACT,qBAAqB,yBACpB,QAAQ;;;KC9BC,mCAAmC;KACnC,2CAA2C;iBAEvC,wCACd,QAAO,4CAEP,SAAS,kCACN,iBAAiB;iBAIN,yCACd,OAAO,0CACP,SAAS,gCACR,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBCsJJ,gBAAgB,UAAS,2BAAgC"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/html-host.ts","../src/html-host-renderer.ts","../src/html-host-registry.ts","../src/html-host-collection-documents.ts","../src/index.ts"],"mappings":";;;;;;;;;;;UASiB;;;;;;EAMf;;UAGe;EACf;EACA;;;;;KAMU,gBAAgB;;;;;;;;KAShB,mBAAmB;KAEnB,wBAAwB;UAEnB,8BAA8B,KAC7C;EAGA;EACA;EACA;;UAGe;EACf;EACA;;UAGe;EACf,IAAI;EACJ,oBAAoB;;KAGV,uBAAuB;KAEvB,yBACV,gBACA,SAAS,0BACN,uBAAuB,QAAQ;KAExB,uBACR;EAEE,SAAS;;;;;;;;;KAUH;;;;;;;;UASK,iCAAiC;;;;;;;;EAQhD;;;;;;;;;;;;;;;;;;EAmBA,aAAa;;;;;;;;EASb,4BAA4B;;;;;;;;;EAU5B;;;;;;;;;;EAWA,WAAW;;;;;;;;;EAUX,SAAS;;;;;;;EAQT,eAAe;;;;;;;;;;;;EAaf,mBAAmB;;;;;UAMJ;;;;;EAKf;;;;;EAMA;;;;;EAMA;;;;;EAMA;;;;;EAMA;;;;;UAMe;;;;;EAKf;;;;;EAMA;;;;;EAMA;;;;;EAMA;;;;;UAMe;;;;;EAKf,mBAAmB;;;;;EAMnB,sBAAsB;;UAGP;EACf,QAAQ;EACR,WAAW;;UAGI;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,iBAAiB;EACjB,YAAY;EACZ;EACA,WAAW;EACX,QAAQ;EACR;EACA;EACA,eAAe;EACf;EACA;;UAGe;EACf;EACA;EACA,UAAU;EACV;EACA,aAAa;;UAGE;EACf;EACA,OAAO;EACP;EACA;EACA;;;;UC1Re,6BAA6B;UAC7B,mCAAmC;KACxC,+BAA+B;UAC1B,iCAAiC;KACtC,2BAA2B;KAC3B,8BAA8B;KAC9B,8BACV,QAAQ,sBACR;EAAW;;UAGI,kCAAkC,KACjD;EAGA,aAAa;EACb,kBAAkB;EAClB,sBAAsB;;UAGP;EACf;EACA;EACA,mBAAmB;EACnB,SAAS;EACT,eAAe;EACf,aAAa;;UAEE,uCAAuC;KAE5C,4BAA4B;KAC5B,mCAAmC;iBAEzB,qBACpB,OAAO,4BACN,QAAQ;iBAUK,4BACd,OAAO,oCACL,SAAS,aAAa,OAAO;;;KCpDrB;UAEK;EACf;EACA;EACA;EACA,aAAa;EACb,YAAY;EACZ,kBAAkB;EAClB,sBAAsB;EACtB,cAAc;;UAGC;EACf;EACA,mBAAmB;EACnB;EACA;EACA;EACA,aAAa;EACb,kBAAkB;EAClB,sBAAsB;;KAGZ,0BACV,cACA,SAAS,kCACN,QAAQ;cAEA,kCAAkC;WACpC,aAAa;EAEtB,YAAY,sBAAsB;;iBAOpB,6BACd,OAAO,oCACN;;;cCvCU;KAED,+BAA+B;KAC/B,4BAA4B;KAC5B,sCAAsC;KACtC,0CAA0C;KAC1C,uCAAuC;KACvC,+BAA+B;iBAE3B,mCACd,QAAO,0CACN;iBAQa,oCACd,OAAO,yCACP,SAAS,qCACT,qBAAqB,yBACpB,QAAQ;;;KC9BC,mCAAmC;KACnC,2CAA2C;iBAEvC,wCACd,QAAO,4CAEP,SAAS,kCACN,iBAAiB;iBAIN,yCACd,OAAO,0CACP,SAAS,gCACR,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBCsJJ,gBAAgB,UAAS,2BAAgC"}
package/dist/index.mjs CHANGED
@@ -1076,21 +1076,10 @@ function toPascalCase(str) {
1076
1076
  const defaultRenderSvelteHtmlComponent = async (component, props, slotHtml) => {
1077
1077
  return renderWithSvelteRuntime(await loadDefaultSvelteRuntime(), component, props, slotHtml);
1078
1078
  };
1079
- function createSvelteHtmlHostComponentRenderer(loadModule) {
1080
- let pending;
1081
- return async (component, props, slotHtml) => {
1082
- pending ??= loadSvelteRuntimeFromHost(loadModule);
1083
- return renderWithSvelteRuntime(await pending, component, props, slotHtml);
1084
- };
1085
- }
1086
1079
  async function loadDefaultSvelteRuntime() {
1087
1080
  const [server, shared] = await Promise.all([import("svelte/server"), import("svelte")]);
1088
1081
  return resolveSvelteRuntime(server, shared);
1089
1082
  }
1090
- async function loadSvelteRuntimeFromHost(loadModule) {
1091
- const [server, shared] = await Promise.all([loadModule("svelte/server"), loadModule("svelte")]);
1092
- return resolveSvelteRuntime(server, shared);
1093
- }
1094
1083
  function renderWithSvelteRuntime(runtime, component, props, slotHtml) {
1095
1084
  const componentProps = slotHtml ? {
1096
1085
  ...props,
@@ -1139,7 +1128,6 @@ var SvelteHtmlHostRenderError = class extends Error {
1139
1128
  };
1140
1129
  function createSvelteHtmlHostRenderer(input) {
1141
1130
  const policy = input.diagnostics ?? "throw";
1142
- const defaultRenderComponent = createSvelteHtmlHostComponentRenderer(input.loadModule);
1143
1131
  return async (html, context) => {
1144
1132
  const root = context.root ?? input.root;
1145
1133
  const result = await renderSvelteHtmlHost({
@@ -1151,7 +1139,7 @@ function createSvelteHtmlHostRenderer(input) {
1151
1139
  imports: context.imports,
1152
1140
  components: context.components ?? input.components,
1153
1141
  loadModule: input.loadModule,
1154
- renderComponent: context.renderComponent ?? input.renderComponent ?? defaultRenderComponent,
1142
+ renderComponent: context.renderComponent ?? input.renderComponent,
1155
1143
  resolveClientModule: context.resolveClientModule ?? input.resolveClientModule ?? ((module) => toHtmlHostClientModuleId$1(module.serverModuleId, root))
1156
1144
  });
1157
1145
  if (policy === "throw" && result.diagnostics.length > 0) throw new SvelteHtmlHostRenderError(result.diagnostics);
@@ -1 +1 @@
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, \"&#39;\")}'`\n : \"\";\n const contentAttr = island.content\n ? ` data-ox-content='${island.content.replace(/'/g, \"&#39;\")}'`\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(\"&quot;\", '\"')\n .replaceAll(\"&#39;\", \"'\")\n .replaceAll(\"&lt;\", \"<\")\n .replaceAll(\"&gt;\", \">\")\n .replaceAll(\"&amp;\", \"&\");\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 { HtmlHostComponentRenderResult } from \"@ox-content/vite-plugin\";\nimport type { SvelteHtmlComponentRenderer, SvelteServerModuleLoader } from \"./html-host\";\n\ntype SvelteServerRuntime = {\n render: (\n component: never,\n options: { props?: Record<string, unknown> },\n ) => { body?: string; head?: 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): HtmlHostComponentRenderResult {\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 {\n html: rendered.html ?? rendered.body ?? \"\",\n head: rendered.head,\n };\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 HtmlHostHeadContribution,\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 headHtml: string;\n headContributions: SvelteHtmlHostHeadContribution[];\n modules: SvelteHtmlHostModule[];\n clientModules: SvelteHtmlHostClientModule[];\n diagnostics: SvelteHtmlHostDiagnostic[];\n}\nexport interface SvelteHtmlHostHeadContribution extends HtmlHostHeadContribution {}\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 SvelteHtmlHostHeadContribution,\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,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F,OAAO;EACL,SAAS;EACT,SAAS,QAAQ,WAAW;CAC9B;AACF;AAEA,SAAS,wBAAgC;CACvC,OAAO;;;;AAIT;AAEA,SAAS,yBAAyB,cAA2C;CAC3E,MAAM,UAAoB,CAAC;CAC3B,MAAM,UAAoB,CAAC;CAE3B,aAAa,SAAS,MAAM,SAAS;EACnC,QAAQ,KAAK,UAAU,KAAK,SAAS,KAAK,GAAG;EAC7C,QAAQ,KAAK,KAAK,KAAK,EAAE;CAC3B,CAAC;CAED,OAAO;EACP,QAAQ,KAAK,IAAI,EAAE;;;EAGnB,QAAQ,KAAK,IAAI,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, \"&#39;\")}'`\n : \"\";\n const contentAttr = island.content\n ? ` data-ox-content='${island.content.replace(/'/g, \"&#39;\")}'`\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(\"&quot;\", '\"')\n .replaceAll(\"&#39;\", \"'\")\n .replaceAll(\"&lt;\", \"<\")\n .replaceAll(\"&gt;\", \">\")\n .replaceAll(\"&amp;\", \"&\");\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 { HtmlHostComponentRenderResult } from \"@ox-content/vite-plugin\";\nimport type { SvelteHtmlComponentRenderer, SvelteServerModuleLoader } from \"./html-host\";\n\ntype SvelteServerRuntime = {\n render: (\n component: never,\n options: { props?: Record<string, unknown> },\n ) => { body?: string; head?: 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): HtmlHostComponentRenderResult {\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 {\n html: rendered.html ?? rendered.body ?? \"\",\n head: rendered.head,\n };\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 HtmlHostHeadContribution,\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 headHtml: string;\n headContributions: SvelteHtmlHostHeadContribution[];\n modules: SvelteHtmlHostModule[];\n clientModules: SvelteHtmlHostClientModule[];\n diagnostics: SvelteHtmlHostDiagnostic[];\n}\nexport interface SvelteHtmlHostHeadContribution extends HtmlHostHeadContribution {}\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 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\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) => 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 SvelteHtmlHostHeadContribution,\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-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IT;AAEA,SAAS,yBAAyB,cAA2C;CAC3E,MAAM,UAAoB,CAAC;CAC3B,MAAM,UAAoB,CAAC;CAE3B,aAAa,SAAS,MAAM,SAAS;EACnC,QAAQ,KAAK,UAAU,KAAK,SAAS,KAAK,GAAG;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.2.0",
3
+ "version": "3.2.1",
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.2.0",
48
- "@ox-content/vite-plugin": "3.2.0"
47
+ "@ox-content/islands": "3.2.1",
48
+ "@ox-content/vite-plugin": "3.2.1"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@rsvelte/vite-plugin-svelte": "^0.5.2",