@ox-content/vite-plugin-svelte 3.0.0-alpha.16 → 3.0.0-alpha.18

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
@@ -271,6 +271,15 @@ function parseProps(propsString) {
271
271
  }
272
272
  return props;
273
273
  }
274
+ /** Opt a document-props component into the island contract. */
275
+ const MDX_ISLAND_DIRECTIVE = "oxIsland";
276
+ const MDX_ISLAND_MEDIA_DIRECTIVE = "oxIslandMedia";
277
+ const MDX_ISLAND_LOAD_STRATEGIES = /* @__PURE__ */ new Set([
278
+ "eager",
279
+ "idle",
280
+ "visible",
281
+ "media"
282
+ ]);
274
283
  function prepareMdxDocumentExpressions(content, filePath) {
275
284
  const skipRanges = mergeRanges([
276
285
  ...collectFenceRanges(content),
@@ -453,15 +462,16 @@ function generateMdxDocumentPropsSvelteModule(html, usedComponents, frontmatter,
453
462
  documentPath: id,
454
463
  root: options.root
455
464
  });
456
- const template = renderMdxDocumentTemplate(html, usedComponents, id, documentExpressions);
457
- return `
465
+ const { template, hydratedIslands } = renderMdxDocumentTemplate(html, usedComponents, id, documentExpressions);
466
+ return `${renderMdxIslandModuleScript(hydratedIslands, imports)}
458
467
  <script>
459
- ${imports}
468
+ ${hydratedIslands.length > 0 ? "" : imports}
460
469
 
461
470
  const frontmatter = ${JSON.stringify(frontmatter)};
462
471
  export { frontmatter };
463
472
 
464
473
  let __ox_mdx_props = $props();
474
+ ${hydratedIslands.length > 0 ? renderMdxIslandPropsSerializer(filePathLiteral) : ""}
465
475
 
466
476
  function __ox_mdx_document_prop(props, path, expression) {
467
477
  const propName = path.join(".");
@@ -492,14 +502,90 @@ function generateMdxDocumentPropsSvelteModule(html, usedComponents, frontmatter,
492
502
  </style>
493
503
  `;
494
504
  }
505
+ /**
506
+ * Island wiring for a document-props page.
507
+ *
508
+ * This host never hydrates the whole page — that is the point of the mode — so
509
+ * the runtime cannot be started from `onMount`. It is exported instead, and the
510
+ * host calls it once on the client. Pages with no islands get no module script
511
+ * at all and stay zero-JavaScript.
512
+ */
513
+ function renderMdxIslandModuleScript(hydratedIslands, imports) {
514
+ if (hydratedIslands.length === 0) return "";
515
+ return `
516
+ <script module>
517
+ import { createRawSnippet, hydrate, mount, unmount } from 'svelte';
518
+ import { initIslands, readIslandSlotHtml } from '@ox-content/islands';
519
+ ${imports}
520
+
521
+ const __ox_island_components = {
522
+ ${hydratedIslands.map((name) => ` ${name},`).join("\n")}
523
+ };
524
+
525
+ export function hydrateIslands(options) {
526
+ return initIslands((element, props) => {
527
+ const Component = __ox_island_components[element.dataset.oxIsland];
528
+ if (!Component) return;
529
+
530
+ const islandContent = readIslandSlotHtml(element);
531
+ const componentProps = { ...props };
532
+ if (islandContent) {
533
+ componentProps.children = createRawSnippet(() => ({
534
+ render: () => \`<div>\${islandContent}</div>\`,
535
+ }));
536
+ }
537
+
538
+ const attach = element.dataset.oxSsr === 'true' ? hydrate : mount;
539
+ const instance = attach(Component, { target: element, props: componentProps });
540
+ return () => unmount(instance);
541
+ }, { selector: '[data-ox-island]', ...options });
542
+ }
543
+ <\/script>`;
544
+ }
545
+ /**
546
+ * `JSON.stringify` drops functions and `undefined` silently and throws an
547
+ * opaque error on a cycle, either of which turns into an island that renders
548
+ * but never comes alive. Walking first turns both into a build diagnostic that
549
+ * names the prop.
550
+ */
551
+ function renderMdxIslandPropsSerializer(filePathLiteral) {
552
+ return `
553
+ function __ox_mdx_island_props(componentName, props) {
554
+ const seen = new WeakSet();
555
+ const check = (value, path) => {
556
+ const kind = typeof value;
557
+ if (value === null || kind === 'string' || kind === 'number' || kind === 'boolean') return;
558
+ if (kind !== 'object') {
559
+ 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.');
560
+ }
561
+ if (seen.has(value)) {
562
+ throw new Error('[ox-content-svelte] Island "' + componentName + '" in ' + ${filePathLiteral} + ' received a circular value for prop "' + path + '", which cannot be serialised for hydration.');
563
+ }
564
+ seen.add(value);
565
+ if (Array.isArray(value)) {
566
+ value.forEach((item, index) => check(item, path + '[' + index + ']'));
567
+ return;
568
+ }
569
+ for (const key of Object.keys(value)) check(value[key], path ? path + '.' + key : key);
570
+ };
571
+ for (const key of Object.keys(props)) check(props[key], key);
572
+ return JSON.stringify(props);
573
+ }
574
+ `;
575
+ }
495
576
  function renderMdxDocumentTemplate(html, usedComponents, filePath, documentExpressions) {
496
- return renderHtmlRange({
577
+ const context = {
497
578
  html,
498
579
  filePath,
499
580
  usedComponents: new Set(usedComponents),
500
581
  expressionsByMarker: new Map(documentExpressions.map((expression) => [expression.marker, expression])),
501
- islandRanges: findMdxIslandRanges(html)
502
- }, 0, html.length);
582
+ islandRanges: findMdxIslandRanges(html),
583
+ hydratedIslands: /* @__PURE__ */ new Set()
584
+ };
585
+ return {
586
+ template: renderHtmlRange(context, 0, html.length),
587
+ hydratedIslands: [...context.hydratedIslands]
588
+ };
503
589
  }
504
590
  function renderHtmlRange(context, start, end) {
505
591
  let output = "";
@@ -562,9 +648,68 @@ function renderDocumentExpression(expression) {
562
648
  }
563
649
  function renderMdxIslandTemplate(context, island) {
564
650
  assertSvelteComponentName(island.name, context.filePath);
565
- const attrs = renderMdxIslandAttributes(readMdxIslandPayload(island), context.filePath);
651
+ const payload = readMdxIslandPayload(island);
652
+ const hydration = takeMdxIslandHydration(payload, island.name, context.filePath);
653
+ const attrs = renderMdxIslandAttributes(payload, context.filePath);
566
654
  const children = renderHtmlRange(context, island.contentStart, island.closeStart);
567
- return children ? `<${island.name}${attrs}>${children}</${island.name}>` : `<${island.name}${attrs} />`;
655
+ const element = children ? `<${island.name}${attrs}>${children}</${island.name}>` : `<${island.name}${attrs} />`;
656
+ if (!hydration) return element;
657
+ context.hydratedIslands.add(island.name);
658
+ const wrapperAttrs = [
659
+ `data-ox-island="${island.name}"`,
660
+ "data-ox-ssr=\"true\"",
661
+ `data-ox-load="${hydration.load}"`
662
+ ];
663
+ if (hydration.media) wrapperAttrs.push(`data-ox-media=${JSON.stringify(hydration.media)}`);
664
+ wrapperAttrs.push(`data-ox-props={${mdxIslandPropsExpression(payload, island.name, context.filePath)}}`);
665
+ return `<div ${wrapperAttrs.join(" ")}>${element}</div>`;
666
+ }
667
+ /**
668
+ * Reads and removes the island directives so they never reach the component.
669
+ *
670
+ * The strategy is a build-time decision, so it has to be a literal: resolving
671
+ * it from a document prop would mean the wrapper could not be written until
672
+ * render time, by which point the load strategy has already been read.
673
+ */
674
+ function takeMdxIslandHydration(payload, name, filePath) {
675
+ for (const directive of [MDX_ISLAND_DIRECTIVE, MDX_ISLAND_MEDIA_DIRECTIVE]) if (directive in payload.expressions) throw new Error(`[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.`);
676
+ if (!(MDX_ISLAND_DIRECTIVE in payload.props)) return void 0;
677
+ const raw = payload.props[MDX_ISLAND_DIRECTIVE];
678
+ const media = payload.props[MDX_ISLAND_MEDIA_DIRECTIVE];
679
+ delete payload.props[MDX_ISLAND_DIRECTIVE];
680
+ delete payload.props[MDX_ISLAND_MEDIA_DIRECTIVE];
681
+ const load = raw === true || raw === "" ? "eager" : raw;
682
+ if (typeof load !== "string" || !MDX_ISLAND_LOAD_STRATEGIES.has(load)) throw new Error(`[ox-content-svelte] Unknown island load strategy ${JSON.stringify(raw)} on <${name}> in ${filePath}. Use ${[...MDX_ISLAND_LOAD_STRATEGIES].join(", ")}.`);
683
+ if (load === "media" && typeof media !== "string") throw new Error(`[ox-content-svelte] <${name} ${MDX_ISLAND_DIRECTIVE}="media"> in ${filePath} needs ${MDX_ISLAND_MEDIA_DIRECTIVE} with the query to wait for.`);
684
+ return {
685
+ load,
686
+ media: typeof media === "string" ? media : void 0
687
+ };
688
+ }
689
+ /**
690
+ * The same props the component is rendered with, serialised for the client.
691
+ *
692
+ * Built in attribute order so a spread and a named prop resolve the way Svelte
693
+ * resolves them in the template above.
694
+ */
695
+ function mdxIslandPropsExpression(payload, name, filePath) {
696
+ const parts = [];
697
+ for (const spread of payload.spreads) {
698
+ const expression = spread.trim().startsWith("...") ? spread.trim().slice(3).trim() : spread.trim();
699
+ const path = parseDocumentPropPath(expression);
700
+ if (!path) throw new Error(`[ox-content-svelte] Unsupported MDX document prop spread "{${spread}}" in ${filePath}. Only identifiers and dotted property paths are supported.`);
701
+ parts.push(documentPropResolverExpression(path, expression));
702
+ }
703
+ const entries = [];
704
+ for (const [key, value] of Object.entries(payload.props)) entries.push(`${JSON.stringify(key)}: ${renderSvelteLiteral(value)}`);
705
+ for (const [key, expression] of Object.entries(payload.expressions)) {
706
+ const path = parseDocumentPropPath(expression.trim());
707
+ if (!path) throw new Error(`[ox-content-svelte] Unsupported MDX document prop expression "{${expression}}" for prop "${key}" in ${filePath}. Only identifiers and dotted property paths are supported.`);
708
+ entries.push(`${JSON.stringify(key)}: ${documentPropResolverExpression(path, expression.trim())}`);
709
+ }
710
+ if (entries.length > 0) parts.push(`{ ${entries.join(", ")} }`);
711
+ const merged = parts.length === 0 ? "{}" : parts.length === 1 ? parts[0] : `Object.assign({}, ${parts.join(", ")})`;
712
+ return `__ox_mdx_island_props(${JSON.stringify(name)}, ${merged})`;
568
713
  }
569
714
  function renderMdxIslandAttributes(payload, filePath) {
570
715
  const attrs = [];
package/dist/index.mjs CHANGED
@@ -246,6 +246,15 @@ function parseProps(propsString) {
246
246
  }
247
247
  return props;
248
248
  }
249
+ /** Opt a document-props component into the island contract. */
250
+ const MDX_ISLAND_DIRECTIVE = "oxIsland";
251
+ const MDX_ISLAND_MEDIA_DIRECTIVE = "oxIslandMedia";
252
+ const MDX_ISLAND_LOAD_STRATEGIES = /* @__PURE__ */ new Set([
253
+ "eager",
254
+ "idle",
255
+ "visible",
256
+ "media"
257
+ ]);
249
258
  function prepareMdxDocumentExpressions(content, filePath) {
250
259
  const skipRanges = mergeRanges([
251
260
  ...collectFenceRanges(content),
@@ -428,15 +437,16 @@ function generateMdxDocumentPropsSvelteModule(html, usedComponents, frontmatter,
428
437
  documentPath: id,
429
438
  root: options.root
430
439
  });
431
- const template = renderMdxDocumentTemplate(html, usedComponents, id, documentExpressions);
432
- return `
440
+ const { template, hydratedIslands } = renderMdxDocumentTemplate(html, usedComponents, id, documentExpressions);
441
+ return `${renderMdxIslandModuleScript(hydratedIslands, imports)}
433
442
  <script>
434
- ${imports}
443
+ ${hydratedIslands.length > 0 ? "" : imports}
435
444
 
436
445
  const frontmatter = ${JSON.stringify(frontmatter)};
437
446
  export { frontmatter };
438
447
 
439
448
  let __ox_mdx_props = $props();
449
+ ${hydratedIslands.length > 0 ? renderMdxIslandPropsSerializer(filePathLiteral) : ""}
440
450
 
441
451
  function __ox_mdx_document_prop(props, path, expression) {
442
452
  const propName = path.join(".");
@@ -467,14 +477,90 @@ function generateMdxDocumentPropsSvelteModule(html, usedComponents, frontmatter,
467
477
  </style>
468
478
  `;
469
479
  }
480
+ /**
481
+ * Island wiring for a document-props page.
482
+ *
483
+ * This host never hydrates the whole page — that is the point of the mode — so
484
+ * the runtime cannot be started from `onMount`. It is exported instead, and the
485
+ * host calls it once on the client. Pages with no islands get no module script
486
+ * at all and stay zero-JavaScript.
487
+ */
488
+ function renderMdxIslandModuleScript(hydratedIslands, imports) {
489
+ if (hydratedIslands.length === 0) return "";
490
+ return `
491
+ <script module>
492
+ import { createRawSnippet, hydrate, mount, unmount } from 'svelte';
493
+ import { initIslands, readIslandSlotHtml } from '@ox-content/islands';
494
+ ${imports}
495
+
496
+ const __ox_island_components = {
497
+ ${hydratedIslands.map((name) => ` ${name},`).join("\n")}
498
+ };
499
+
500
+ export function hydrateIslands(options) {
501
+ return initIslands((element, props) => {
502
+ const Component = __ox_island_components[element.dataset.oxIsland];
503
+ if (!Component) return;
504
+
505
+ const islandContent = readIslandSlotHtml(element);
506
+ const componentProps = { ...props };
507
+ if (islandContent) {
508
+ componentProps.children = createRawSnippet(() => ({
509
+ render: () => \`<div>\${islandContent}</div>\`,
510
+ }));
511
+ }
512
+
513
+ const attach = element.dataset.oxSsr === 'true' ? hydrate : mount;
514
+ const instance = attach(Component, { target: element, props: componentProps });
515
+ return () => unmount(instance);
516
+ }, { selector: '[data-ox-island]', ...options });
517
+ }
518
+ <\/script>`;
519
+ }
520
+ /**
521
+ * `JSON.stringify` drops functions and `undefined` silently and throws an
522
+ * opaque error on a cycle, either of which turns into an island that renders
523
+ * but never comes alive. Walking first turns both into a build diagnostic that
524
+ * names the prop.
525
+ */
526
+ function renderMdxIslandPropsSerializer(filePathLiteral) {
527
+ return `
528
+ function __ox_mdx_island_props(componentName, props) {
529
+ const seen = new WeakSet();
530
+ const check = (value, path) => {
531
+ const kind = typeof value;
532
+ if (value === null || kind === 'string' || kind === 'number' || kind === 'boolean') return;
533
+ if (kind !== 'object') {
534
+ 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.');
535
+ }
536
+ if (seen.has(value)) {
537
+ throw new Error('[ox-content-svelte] Island "' + componentName + '" in ' + ${filePathLiteral} + ' received a circular value for prop "' + path + '", which cannot be serialised for hydration.');
538
+ }
539
+ seen.add(value);
540
+ if (Array.isArray(value)) {
541
+ value.forEach((item, index) => check(item, path + '[' + index + ']'));
542
+ return;
543
+ }
544
+ for (const key of Object.keys(value)) check(value[key], path ? path + '.' + key : key);
545
+ };
546
+ for (const key of Object.keys(props)) check(props[key], key);
547
+ return JSON.stringify(props);
548
+ }
549
+ `;
550
+ }
470
551
  function renderMdxDocumentTemplate(html, usedComponents, filePath, documentExpressions) {
471
- return renderHtmlRange({
552
+ const context = {
472
553
  html,
473
554
  filePath,
474
555
  usedComponents: new Set(usedComponents),
475
556
  expressionsByMarker: new Map(documentExpressions.map((expression) => [expression.marker, expression])),
476
- islandRanges: findMdxIslandRanges(html)
477
- }, 0, html.length);
557
+ islandRanges: findMdxIslandRanges(html),
558
+ hydratedIslands: /* @__PURE__ */ new Set()
559
+ };
560
+ return {
561
+ template: renderHtmlRange(context, 0, html.length),
562
+ hydratedIslands: [...context.hydratedIslands]
563
+ };
478
564
  }
479
565
  function renderHtmlRange(context, start, end) {
480
566
  let output = "";
@@ -537,9 +623,68 @@ function renderDocumentExpression(expression) {
537
623
  }
538
624
  function renderMdxIslandTemplate(context, island) {
539
625
  assertSvelteComponentName(island.name, context.filePath);
540
- const attrs = renderMdxIslandAttributes(readMdxIslandPayload(island), context.filePath);
626
+ const payload = readMdxIslandPayload(island);
627
+ const hydration = takeMdxIslandHydration(payload, island.name, context.filePath);
628
+ const attrs = renderMdxIslandAttributes(payload, context.filePath);
541
629
  const children = renderHtmlRange(context, island.contentStart, island.closeStart);
542
- return children ? `<${island.name}${attrs}>${children}</${island.name}>` : `<${island.name}${attrs} />`;
630
+ const element = children ? `<${island.name}${attrs}>${children}</${island.name}>` : `<${island.name}${attrs} />`;
631
+ if (!hydration) return element;
632
+ context.hydratedIslands.add(island.name);
633
+ const wrapperAttrs = [
634
+ `data-ox-island="${island.name}"`,
635
+ "data-ox-ssr=\"true\"",
636
+ `data-ox-load="${hydration.load}"`
637
+ ];
638
+ if (hydration.media) wrapperAttrs.push(`data-ox-media=${JSON.stringify(hydration.media)}`);
639
+ wrapperAttrs.push(`data-ox-props={${mdxIslandPropsExpression(payload, island.name, context.filePath)}}`);
640
+ return `<div ${wrapperAttrs.join(" ")}>${element}</div>`;
641
+ }
642
+ /**
643
+ * Reads and removes the island directives so they never reach the component.
644
+ *
645
+ * The strategy is a build-time decision, so it has to be a literal: resolving
646
+ * it from a document prop would mean the wrapper could not be written until
647
+ * render time, by which point the load strategy has already been read.
648
+ */
649
+ function takeMdxIslandHydration(payload, name, filePath) {
650
+ for (const directive of [MDX_ISLAND_DIRECTIVE, MDX_ISLAND_MEDIA_DIRECTIVE]) if (directive in payload.expressions) throw new Error(`[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.`);
651
+ if (!(MDX_ISLAND_DIRECTIVE in payload.props)) return void 0;
652
+ const raw = payload.props[MDX_ISLAND_DIRECTIVE];
653
+ const media = payload.props[MDX_ISLAND_MEDIA_DIRECTIVE];
654
+ delete payload.props[MDX_ISLAND_DIRECTIVE];
655
+ delete payload.props[MDX_ISLAND_MEDIA_DIRECTIVE];
656
+ const load = raw === true || raw === "" ? "eager" : raw;
657
+ if (typeof load !== "string" || !MDX_ISLAND_LOAD_STRATEGIES.has(load)) throw new Error(`[ox-content-svelte] Unknown island load strategy ${JSON.stringify(raw)} on <${name}> in ${filePath}. Use ${[...MDX_ISLAND_LOAD_STRATEGIES].join(", ")}.`);
658
+ if (load === "media" && typeof media !== "string") throw new Error(`[ox-content-svelte] <${name} ${MDX_ISLAND_DIRECTIVE}="media"> in ${filePath} needs ${MDX_ISLAND_MEDIA_DIRECTIVE} with the query to wait for.`);
659
+ return {
660
+ load,
661
+ media: typeof media === "string" ? media : void 0
662
+ };
663
+ }
664
+ /**
665
+ * The same props the component is rendered with, serialised for the client.
666
+ *
667
+ * Built in attribute order so a spread and a named prop resolve the way Svelte
668
+ * resolves them in the template above.
669
+ */
670
+ function mdxIslandPropsExpression(payload, name, filePath) {
671
+ const parts = [];
672
+ for (const spread of payload.spreads) {
673
+ const expression = spread.trim().startsWith("...") ? spread.trim().slice(3).trim() : spread.trim();
674
+ const path = parseDocumentPropPath(expression);
675
+ if (!path) throw new Error(`[ox-content-svelte] Unsupported MDX document prop spread "{${spread}}" in ${filePath}. Only identifiers and dotted property paths are supported.`);
676
+ parts.push(documentPropResolverExpression(path, expression));
677
+ }
678
+ const entries = [];
679
+ for (const [key, value] of Object.entries(payload.props)) entries.push(`${JSON.stringify(key)}: ${renderSvelteLiteral(value)}`);
680
+ for (const [key, expression] of Object.entries(payload.expressions)) {
681
+ const path = parseDocumentPropPath(expression.trim());
682
+ if (!path) throw new Error(`[ox-content-svelte] Unsupported MDX document prop expression "{${expression}}" for prop "${key}" in ${filePath}. Only identifiers and dotted property paths are supported.`);
683
+ entries.push(`${JSON.stringify(key)}: ${documentPropResolverExpression(path, expression.trim())}`);
684
+ }
685
+ if (entries.length > 0) parts.push(`{ ${entries.join(", ")} }`);
686
+ const merged = parts.length === 0 ? "{}" : parts.length === 1 ? parts[0] : `Object.assign({}, ${parts.join(", ")})`;
687
+ return `__ox_mdx_island_props(${JSON.stringify(name)}, ${merged})`;
543
688
  }
544
689
  function renderMdxIslandAttributes(payload, filePath) {
545
690
  const attrs = [];
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["baseTransformMarkdown","oxContent"],"sources":["../src/transform.ts","../src/environment.ts","../src/index.ts"],"sourcesContent":["import {\n applyIslandSsrHtml,\n discoverDocumentMdxIslands,\n renderIslandComponentImports,\n resolveContentRootPath,\n resolveMdxForFilePath,\n transformMarkdown as baseTransformMarkdown,\n type ResolvedDocumentComponentImport,\n} from \"@ox-content/vite-plugin\";\nimport { compile } from \"svelte/compiler\";\nimport type {\n ResolvedSvelteOptions,\n SvelteTransformResult,\n ComponentIsland,\n ComponentsMap,\n} from \"./types\";\n\nconst COMPONENT_REGEX = /<([A-Z][a-zA-Z0-9]*)\\s*([^>]*?)\\s*(?:\\/>|>([\\s\\S]*?)<\\/\\1>)/g;\nconst PROP_REGEX = /([a-zA-Z0-9-]+)(?:=(?:\"([^\"]*)\"|'([^']*)'|{([^}]*)}|\\[([^\\]]*)\\]))?/g;\n\nconst ISLAND_MARKER_PREFIX = \"OXCONTENT-ISLAND-\";\nconst ISLAND_MARKER_SUFFIX = \"-PLACEHOLDER\";\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.ssr,\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.ssr,\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.ssr,\n );\n}\n\nfunction compileSvelteResult(\n svelteCode: string,\n id: string,\n usedComponents: string[],\n frontmatter: Record<string, unknown>,\n ssr = false,\n): SvelteTransformResult {\n const compiled = compile(svelteCode, {\n filename: id,\n generate: ssr ? \"server\" : \"client\",\n runes: true,\n });\n\n return {\n code: `${compiled.js.code}\\nexport const frontmatter = ${JSON.stringify(frontmatter)};`,\n map: null,\n usedComponents,\n frontmatter,\n };\n}\n\nfunction createIslandMarker(islandId: string): string {\n return `${ISLAND_MARKER_PREFIX}${islandId}${ISLAND_MARKER_SUFFIX}`;\n}\n\nfunction collectFenceRanges(content: string): Range[] {\n const ranges: Range[] = [];\n let inFence = false;\n let fenceChar = \"\";\n let fenceLength = 0;\n let fenceStart = 0;\n let pos = 0;\n\n while (pos < content.length) {\n const lineEnd = content.indexOf(\"\\n\", pos);\n const next = lineEnd === -1 ? content.length : lineEnd + 1;\n const line = content.slice(pos, lineEnd === -1 ? content.length : lineEnd);\n const fenceMatch = line.match(/^\\s{0,3}([`~]{3,})/);\n\n if (fenceMatch) {\n const marker = fenceMatch[1];\n if (!inFence) {\n inFence = true;\n fenceChar = marker[0];\n fenceLength = marker.length;\n fenceStart = pos;\n } else if (marker[0] === fenceChar && marker.length >= fenceLength) {\n inFence = false;\n ranges.push({ start: fenceStart, end: next });\n fenceChar = \"\";\n fenceLength = 0;\n }\n }\n\n pos = next;\n }\n\n if (inFence) {\n ranges.push({ start: fenceStart, end: content.length });\n }\n\n return ranges;\n}\n\nfunction isInRanges(start: number, end: number, ranges: Range[]): boolean {\n for (const range of ranges) {\n if (start < range.end && end > range.start) {\n return true;\n }\n }\n return false;\n}\n\nfunction injectIslandMarkers(html: string, islands: ComponentIsland[]): string {\n let output = html;\n\n for (const island of islands) {\n const marker = createIslandMarker(island.id);\n const propsAttr =\n Object.keys(island.props).length > 0\n ? ` data-ox-props='${JSON.stringify(island.props).replace(/'/g, \"&#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}\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 = renderMdxDocumentTemplate(html, usedComponents, id, documentExpressions);\n\n return `\n<script>\n ${imports}\n\n const frontmatter = ${JSON.stringify(frontmatter)};\n export { frontmatter };\n\n let __ox_mdx_props = $props();\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\nfunction renderMdxDocumentTemplate(\n html: string,\n usedComponents: string[],\n filePath: string,\n documentExpressions: readonly MdxDocumentExpression[],\n): 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 };\n return renderHtmlRange(context, 0, html.length);\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 attrs = renderMdxIslandAttributes(readMdxIslandPayload(island), context.filePath);\n const children = renderHtmlRange(context, island.contentStart, island.closeStart);\n return children\n ? `<${island.name}${attrs}>${children}</${island.name}>`\n : `<${island.name}${attrs} />`;\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 * Vite Plugin for Ox Content Svelte Integration\n *\n * Uses Vite's Environment API to enable embedding Svelte components in Markdown.\n */\n\nimport * as fs from \"fs\";\nimport * as path from \"path\";\nimport type { Plugin, PluginOption, ResolvedConfig } from \"vite\";\nimport { oxContent } from \"@ox-content/vite-plugin\";\nimport { transformMarkdownWithSvelte } from \"./transform\";\nimport { createSvelteMarkdownEnvironment } from \"./environment\";\nimport type {\n SvelteIntegrationOptions,\n ResolvedSvelteOptions,\n ComponentsMap,\n ComponentsOption,\n BuiltinEmbedOptions,\n} from \"./types\";\n\nconst DEFAULT_MARKDOWN_EXTENSIONS = [\".md\", \".markdown\", \".mdx\"] as const;\n\nfunction normalizeMarkdownExtensions(extensions?: readonly string[]): string[] {\n const values = extensions?.length ? extensions : DEFAULT_MARKDOWN_EXTENSIONS;\n return Array.from(\n new Map(\n values.map((extension) => {\n const value = extension.startsWith(\".\") ? extension : `.${extension}`;\n return [value.toLowerCase(), value] as const;\n }),\n ).values(),\n );\n}\n\nfunction isMarkdownFilePath(filePath: string, extensions: readonly string[]): boolean {\n const pathname = filePath.split(\"?\")[0].split(\"#\")[0].toLowerCase();\n return extensions.some((extension) => pathname.endsWith(extension.toLowerCase()));\n}\n\nfunction resolveBuiltinEmbedOptions(\n options: BuiltinEmbedOptions | false | undefined,\n): ResolvedSvelteOptions[\"embeds\"] {\n if (options === false) return { github: false, openGraph: false };\n return {\n github: resolveSingleEmbedOptions(options?.github),\n openGraph: resolveSingleEmbedOptions(options?.openGraph),\n };\n}\n\nfunction resolveSingleEmbedOptions<T extends object>(options: boolean | T | undefined): T | false {\n if (options === false) return false;\n if (options === true || options === undefined) return {} as T;\n return options;\n}\n\nexport type {\n SvelteIntegrationOptions,\n ResolvedSvelteOptions,\n ComponentsOption,\n ComponentsMap,\n BuiltinEmbedOptions,\n MdxDocumentPropsOption,\n GitHubEmbedOptions,\n OpenGraphEmbedOptions,\n ResolvedBuiltinEmbedOptions,\n SvelteTransformResult,\n ComponentIsland,\n} from \"./types\";\n\n/**\n * Creates the Ox Content Svelte integration plugin.\n *\n * 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 return {\n code: result.code,\n map: result.map,\n };\n },\n };\n\n const svelteEnvironmentPlugin: Plugin = {\n name: \"ox-content:svelte-environment\",\n\n config() {\n return {\n environments: {\n oxcontent_ssr: createSvelteMarkdownEnvironment(\"ssr\", resolved),\n oxcontent_client: createSvelteMarkdownEnvironment(\"client\", resolved),\n },\n };\n },\n\n resolveId(id) {\n if (id === \"virtual:ox-content-svelte/runtime\") {\n return \"\\0virtual:ox-content-svelte/runtime\";\n }\n if (id === \"virtual:ox-content-svelte/components\") {\n return \"\\0virtual:ox-content-svelte/components\";\n }\n return null;\n },\n\n load(id) {\n if (id === \"\\0virtual:ox-content-svelte/runtime\") {\n return generateRuntimeModule();\n }\n if (id === \"\\0virtual:ox-content-svelte/components\") {\n return generateComponentsModule(componentMap);\n }\n return null;\n },\n\n applyToEnvironment(environment) {\n return [\"oxcontent_ssr\", \"oxcontent_client\", \"client\", \"ssr\"].includes(environment.name);\n },\n };\n\n const svelteHmrPlugin: Plugin = {\n name: \"ox-content:svelte-hmr\",\n apply: \"serve\",\n\n handleHotUpdate({ file, server, modules }) {\n const isComponent = Array.from(componentMap.values()).some((path) =>\n file.endsWith(path.replace(/^\\.\\//, \"\")),\n );\n\n if (isComponent) {\n const mdModules = Array.from(server.moduleGraph.idToModuleMap.values()).filter(\n (mod) => mod.file && isMarkdownFilePath(mod.file, resolved.extensions),\n );\n\n if (mdModules.length > 0) {\n server.ws.send({\n type: \"custom\",\n event: \"ox-content:svelte-update\",\n data: { file },\n });\n return [...modules, ...mdModules];\n }\n }\n\n return modules;\n },\n };\n\n const 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 embeds: resolveBuiltinEmbedOptions(options.embeds),\n mdx: options.mdx,\n mdxDocumentProps: options.mdxDocumentProps ?? false,\n };\n}\n\nfunction resolveCodeAnnotationsOptions(\n options: SvelteIntegrationOptions[\"codeAnnotations\"],\n): ResolvedSvelteOptions[\"codeAnnotations\"] {\n if (!options) {\n return {\n enabled: false,\n metaKey: \"annotate\",\n };\n }\n\n if (options === true) {\n return {\n enabled: true,\n metaKey: \"annotate\",\n };\n }\n\n return {\n enabled: true,\n metaKey: options.metaKey ?? \"annotate\",\n };\n}\n\nfunction generateRuntimeModule(): string {\n return `\n// Svelte 5 runtime for ox-content\nexport { mount, unmount } from 'svelte';\n`;\n}\n\nfunction generateComponentsModule(componentMap: Map<string, string>): string {\n const imports: string[] = [];\n const exports: string[] = [];\n\n componentMap.forEach((path, name) => {\n imports.push(`import ${name} from '${path}';`);\n exports.push(` ${name},`);\n });\n\n return `\n${imports.join(\"\\n\")}\n\nexport const components = {\n${exports.join(\"\\n\")}\n};\n\nexport default components;\n`;\n}\n\nasync function resolveComponentsGlob(\n componentsOption: ComponentsOption,\n root: string,\n): Promise<ComponentsMap> {\n if (typeof componentsOption === \"object\" && !Array.isArray(componentsOption)) {\n return componentsOption;\n }\n\n const patterns = Array.isArray(componentsOption) ? componentsOption : [componentsOption];\n\n const result: ComponentsMap = {};\n\n for (const pattern of patterns) {\n const files = await globFiles(pattern, root);\n\n for (const file of files) {\n const baseName = path.basename(file, path.extname(file));\n const componentName = toPascalCase(baseName);\n const relativePath = \"./\" + path.relative(root, file).replace(/\\\\/g, \"/\");\n\n result[componentName] = relativePath;\n }\n }\n\n return result;\n}\n\nasync function globFiles(pattern: string, root: string): Promise<string[]> {\n const files: string[] = [];\n const isGlob = pattern.includes(\"*\");\n\n if (!isGlob) {\n const fullPath = path.resolve(root, pattern);\n if (fs.existsSync(fullPath)) {\n files.push(fullPath);\n }\n return files;\n }\n\n const parts = pattern.split(\"*\");\n const baseDir = path.resolve(root, parts[0]);\n const ext = parts[1] || \"\";\n\n if (!fs.existsSync(baseDir)) {\n return files;\n }\n\n if (pattern.includes(\"**\")) {\n await walkDir(baseDir, files, ext);\n } else {\n const entries = await fs.promises.readdir(baseDir, { withFileTypes: true });\n for (const entry of entries) {\n if (entry.isFile() && entry.name.endsWith(ext)) {\n files.push(path.join(baseDir, entry.name));\n }\n }\n }\n\n return files;\n}\n\nasync function walkDir(dir: string, files: string[], ext: string): Promise<void> {\n const entries = await fs.promises.readdir(dir, { withFileTypes: true });\n\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name);\n\n if (entry.isDirectory()) {\n await walkDir(fullPath, files, ext);\n } else if (entry.isFile() && entry.name.endsWith(ext)) {\n files.push(fullPath);\n }\n }\n}\n\nfunction toPascalCase(str: string): string {\n return str.replace(/[-_](\\w)/g, (_, c) => c.toUpperCase()).replace(/^\\w/, (c) => c.toUpperCase());\n}\n\nexport { oxContent, renderHead } from \"@ox-content/vite-plugin\";\nexport type { HeadInput, RenderedHead } from \"@ox-content/vite-plugin\";\n"],"mappings":";;;;;AAiBA,MAAM,kBAAkB;AACxB,MAAM,aAAa;AAEnB,MAAM,uBAAuB;AAC7B,MAAM,uBAAuB;AAC7B,MAAM,8BAA8B;AACpC,MAAM,8BAA8B;AACpC,MAAM,iBAAiB;AACvB,MAAM,oCAAoB,IAAI,IAAI;CAAC;CAAS;CAAe;AAAS,CAAC;AAOrE,eAAsB,4BACpB,MACA,IACA,SACgC;CAChC,MAAM,aAA4B,QAAQ;CAC1C,MAAM,EAAE,SAAS,iBAAiB,gBAAgB,mBAAmB,IAAI;CACzE,MAAM,MAAM,sBAAsB,IAAI,QAAQ,GAAG;CAEjD,MAAM,cAAc;EAClB,QAAQ,QAAQ;EAChB,QAAQ,QAAQ;EAChB,MAAM,QAAQ;EACd,YAAY,QAAQ;EACpB;EACA,KAAK;GACH,SAAS;GACT,WAAW;GACX,OAAO;GACP,MAAM;GACN,iBAAiB;GACjB,aAAa;GACb,YAAY;GACZ,aAAa;GACb,QAAQ;GACR,cAAc;GACd,gBAAgB;GAChB,MAAM;GACN,YAAY;EACd;EACA,KAAK,QAAQ;EACb,aAAa;EACb,KAAK,QAAQ;EACb,aAAa,QAAQ;EACrB,iBAAiB,QAAQ;EACzB,WAAW;EACX,QAAQ;EACR,WAAW;EACX,eAAe;EACf,WAAW,QAAQ;EACnB,WAAW;EACX,SAAS;EACT,SAAS;EACT,gBAAgB;GACd,WAAW;GACX,OAAO;GACP,QAAQ;GACR,OAAO;GACP,aAAa;EACf;EACA,cAAc,CAAC;EACf,MAAM;EACN,UAAU;EACV,QAAQ;GACN,SAAS;GACT,OAAO;GACP,QAAQ;GACR,aAAa;GACb,QAAQ;EACV;EACA,QAAQ,QAAQ;EAChB,MAAM;CACR;CAIA,IAAI,KAAK;EACP,MAAM,sBAAsB,QAAQ,mBAChC,8BAA8B,iBAAiB,EAAE,IACjD;GAAE,SAAS;GAAiB,aA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AAS;EAC3B,MAAM,WAAW,KAAK,KAAK,KAAK,MAAM,IAAI;EAE1C,IAAI,MAAM,YAAY,GACpB,MAAM,QAAQ,UAAU,OAAO,GAAG;OAC7B,IAAI,MAAM,OAAO,KAAK,MAAM,KAAK,SAAS,GAAG,GAClD,MAAM,KAAK,QAAQ;CAEvB;AACF;AAEA,SAAS,aAAa,KAAqB;CACzC,OAAO,IAAI,QAAQ,cAAc,GAAG,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,QAAQ,QAAQ,MAAM,EAAE,YAAY,CAAC;AAClG"}
1
+ {"version":3,"file":"index.mjs","names":["baseTransformMarkdown","oxContent"],"sources":["../src/transform.ts","../src/environment.ts","../src/index.ts"],"sourcesContent":["import {\n applyIslandSsrHtml,\n discoverDocumentMdxIslands,\n renderIslandComponentImports,\n resolveContentRootPath,\n resolveMdxForFilePath,\n transformMarkdown as baseTransformMarkdown,\n type ResolvedDocumentComponentImport,\n} from \"@ox-content/vite-plugin\";\nimport { compile } from \"svelte/compiler\";\nimport type {\n ResolvedSvelteOptions,\n SvelteTransformResult,\n ComponentIsland,\n ComponentsMap,\n} from \"./types\";\n\nconst COMPONENT_REGEX = /<([A-Z][a-zA-Z0-9]*)\\s*([^>]*?)\\s*(?:\\/>|>([\\s\\S]*?)<\\/\\1>)/g;\nconst PROP_REGEX = /([a-zA-Z0-9-]+)(?:=(?:\"([^\"]*)\"|'([^']*)'|{([^}]*)}|\\[([^\\]]*)\\]))?/g;\n\nconst ISLAND_MARKER_PREFIX = \"OXCONTENT-ISLAND-\";\nconst ISLAND_MARKER_SUFFIX = \"-PLACEHOLDER\";\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.ssr,\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.ssr,\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.ssr,\n );\n}\n\nfunction compileSvelteResult(\n svelteCode: string,\n id: string,\n usedComponents: string[],\n frontmatter: Record<string, unknown>,\n ssr = false,\n): SvelteTransformResult {\n const compiled = compile(svelteCode, {\n filename: id,\n generate: ssr ? \"server\" : \"client\",\n runes: true,\n });\n\n return {\n code: `${compiled.js.code}\\nexport const frontmatter = ${JSON.stringify(frontmatter)};`,\n map: null,\n usedComponents,\n frontmatter,\n };\n}\n\nfunction createIslandMarker(islandId: string): string {\n return `${ISLAND_MARKER_PREFIX}${islandId}${ISLAND_MARKER_SUFFIX}`;\n}\n\nfunction collectFenceRanges(content: string): Range[] {\n const ranges: Range[] = [];\n let inFence = false;\n let fenceChar = \"\";\n let fenceLength = 0;\n let fenceStart = 0;\n let pos = 0;\n\n while (pos < content.length) {\n const lineEnd = content.indexOf(\"\\n\", pos);\n const next = lineEnd === -1 ? content.length : lineEnd + 1;\n const line = content.slice(pos, lineEnd === -1 ? content.length : lineEnd);\n const fenceMatch = line.match(/^\\s{0,3}([`~]{3,})/);\n\n if (fenceMatch) {\n const marker = fenceMatch[1];\n if (!inFence) {\n inFence = true;\n fenceChar = marker[0];\n fenceLength = marker.length;\n fenceStart = pos;\n } else if (marker[0] === fenceChar && marker.length >= fenceLength) {\n inFence = false;\n ranges.push({ start: fenceStart, end: next });\n fenceChar = \"\";\n fenceLength = 0;\n }\n }\n\n pos = next;\n }\n\n if (inFence) {\n ranges.push({ start: fenceStart, end: content.length });\n }\n\n return ranges;\n}\n\nfunction isInRanges(start: number, end: number, ranges: Range[]): boolean {\n for (const range of ranges) {\n if (start < range.end && end > range.start) {\n return true;\n }\n }\n return false;\n}\n\nfunction injectIslandMarkers(html: string, islands: ComponentIsland[]): string {\n let output = html;\n\n for (const island of islands) {\n const marker = createIslandMarker(island.id);\n const propsAttr =\n Object.keys(island.props).length > 0\n ? ` data-ox-props='${JSON.stringify(island.props).replace(/'/g, \"&#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 * Vite Plugin for Ox Content Svelte Integration\n *\n * Uses Vite's Environment API to enable embedding Svelte components in Markdown.\n */\n\nimport * as fs from \"fs\";\nimport * as path from \"path\";\nimport type { Plugin, PluginOption, ResolvedConfig } from \"vite\";\nimport { oxContent } from \"@ox-content/vite-plugin\";\nimport { transformMarkdownWithSvelte } from \"./transform\";\nimport { createSvelteMarkdownEnvironment } from \"./environment\";\nimport type {\n SvelteIntegrationOptions,\n ResolvedSvelteOptions,\n ComponentsMap,\n ComponentsOption,\n BuiltinEmbedOptions,\n} from \"./types\";\n\nconst DEFAULT_MARKDOWN_EXTENSIONS = [\".md\", \".markdown\", \".mdx\"] as const;\n\nfunction normalizeMarkdownExtensions(extensions?: readonly string[]): string[] {\n const values = extensions?.length ? extensions : DEFAULT_MARKDOWN_EXTENSIONS;\n return Array.from(\n new Map(\n values.map((extension) => {\n const value = extension.startsWith(\".\") ? extension : `.${extension}`;\n return [value.toLowerCase(), value] as const;\n }),\n ).values(),\n );\n}\n\nfunction isMarkdownFilePath(filePath: string, extensions: readonly string[]): boolean {\n const pathname = filePath.split(\"?\")[0].split(\"#\")[0].toLowerCase();\n return extensions.some((extension) => pathname.endsWith(extension.toLowerCase()));\n}\n\nfunction resolveBuiltinEmbedOptions(\n options: BuiltinEmbedOptions | false | undefined,\n): ResolvedSvelteOptions[\"embeds\"] {\n if (options === false) return { github: false, openGraph: false };\n return {\n github: resolveSingleEmbedOptions(options?.github),\n openGraph: resolveSingleEmbedOptions(options?.openGraph),\n };\n}\n\nfunction resolveSingleEmbedOptions<T extends object>(options: boolean | T | undefined): T | false {\n if (options === false) return false;\n if (options === true || options === undefined) return {} as T;\n return options;\n}\n\nexport type {\n SvelteIntegrationOptions,\n ResolvedSvelteOptions,\n ComponentsOption,\n ComponentsMap,\n BuiltinEmbedOptions,\n MdxDocumentPropsOption,\n GitHubEmbedOptions,\n OpenGraphEmbedOptions,\n ResolvedBuiltinEmbedOptions,\n SvelteTransformResult,\n ComponentIsland,\n} from \"./types\";\n\n/**\n * Creates the Ox Content Svelte integration plugin.\n *\n * 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 return {\n code: result.code,\n map: result.map,\n };\n },\n };\n\n const svelteEnvironmentPlugin: Plugin = {\n name: \"ox-content:svelte-environment\",\n\n config() {\n return {\n environments: {\n oxcontent_ssr: createSvelteMarkdownEnvironment(\"ssr\", resolved),\n oxcontent_client: createSvelteMarkdownEnvironment(\"client\", resolved),\n },\n };\n },\n\n resolveId(id) {\n if (id === \"virtual:ox-content-svelte/runtime\") {\n return \"\\0virtual:ox-content-svelte/runtime\";\n }\n if (id === \"virtual:ox-content-svelte/components\") {\n return \"\\0virtual:ox-content-svelte/components\";\n }\n return null;\n },\n\n load(id) {\n if (id === \"\\0virtual:ox-content-svelte/runtime\") {\n return generateRuntimeModule();\n }\n if (id === \"\\0virtual:ox-content-svelte/components\") {\n return generateComponentsModule(componentMap);\n }\n return null;\n },\n\n applyToEnvironment(environment) {\n return [\"oxcontent_ssr\", \"oxcontent_client\", \"client\", \"ssr\"].includes(environment.name);\n },\n };\n\n const svelteHmrPlugin: Plugin = {\n name: \"ox-content:svelte-hmr\",\n apply: \"serve\",\n\n handleHotUpdate({ file, server, modules }) {\n const isComponent = Array.from(componentMap.values()).some((path) =>\n file.endsWith(path.replace(/^\\.\\//, \"\")),\n );\n\n if (isComponent) {\n const mdModules = Array.from(server.moduleGraph.idToModuleMap.values()).filter(\n (mod) => mod.file && isMarkdownFilePath(mod.file, resolved.extensions),\n );\n\n if (mdModules.length > 0) {\n server.ws.send({\n type: \"custom\",\n event: \"ox-content:svelte-update\",\n data: { file },\n });\n return [...modules, ...mdModules];\n }\n }\n\n return modules;\n },\n };\n\n const 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 embeds: resolveBuiltinEmbedOptions(options.embeds),\n mdx: options.mdx,\n mdxDocumentProps: options.mdxDocumentProps ?? false,\n };\n}\n\nfunction resolveCodeAnnotationsOptions(\n options: SvelteIntegrationOptions[\"codeAnnotations\"],\n): ResolvedSvelteOptions[\"codeAnnotations\"] {\n if (!options) {\n return {\n enabled: false,\n metaKey: \"annotate\",\n };\n }\n\n if (options === true) {\n return {\n enabled: true,\n metaKey: \"annotate\",\n };\n }\n\n return {\n enabled: true,\n metaKey: options.metaKey ?? \"annotate\",\n };\n}\n\nfunction generateRuntimeModule(): string {\n return `\n// Svelte 5 runtime for ox-content\nexport { mount, unmount } from 'svelte';\n`;\n}\n\nfunction generateComponentsModule(componentMap: Map<string, string>): string {\n const imports: string[] = [];\n const exports: string[] = [];\n\n componentMap.forEach((path, name) => {\n imports.push(`import ${name} from '${path}';`);\n exports.push(` ${name},`);\n });\n\n return `\n${imports.join(\"\\n\")}\n\nexport const components = {\n${exports.join(\"\\n\")}\n};\n\nexport default components;\n`;\n}\n\nasync function resolveComponentsGlob(\n componentsOption: ComponentsOption,\n root: string,\n): Promise<ComponentsMap> {\n if (typeof componentsOption === \"object\" && !Array.isArray(componentsOption)) {\n return componentsOption;\n }\n\n const patterns = Array.isArray(componentsOption) ? componentsOption : [componentsOption];\n\n const result: ComponentsMap = {};\n\n for (const pattern of patterns) {\n const files = await globFiles(pattern, root);\n\n for (const file of files) {\n const baseName = path.basename(file, path.extname(file));\n const componentName = toPascalCase(baseName);\n const relativePath = \"./\" + path.relative(root, file).replace(/\\\\/g, \"/\");\n\n result[componentName] = relativePath;\n }\n }\n\n return result;\n}\n\nasync function globFiles(pattern: string, root: string): Promise<string[]> {\n const files: string[] = [];\n const isGlob = pattern.includes(\"*\");\n\n if (!isGlob) {\n const fullPath = path.resolve(root, pattern);\n if (fs.existsSync(fullPath)) {\n files.push(fullPath);\n }\n return files;\n }\n\n const parts = pattern.split(\"*\");\n const baseDir = path.resolve(root, parts[0]);\n const ext = parts[1] || \"\";\n\n if (!fs.existsSync(baseDir)) {\n return files;\n }\n\n if (pattern.includes(\"**\")) {\n await walkDir(baseDir, files, ext);\n } else {\n const entries = await fs.promises.readdir(baseDir, { withFileTypes: true });\n for (const entry of entries) {\n if (entry.isFile() && entry.name.endsWith(ext)) {\n files.push(path.join(baseDir, entry.name));\n }\n }\n }\n\n return files;\n}\n\nasync function walkDir(dir: string, files: string[], ext: string): Promise<void> {\n const entries = await fs.promises.readdir(dir, { withFileTypes: true });\n\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name);\n\n if (entry.isDirectory()) {\n await walkDir(fullPath, files, ext);\n } else if (entry.isFile() && entry.name.endsWith(ext)) {\n files.push(fullPath);\n }\n }\n}\n\nfunction toPascalCase(str: string): string {\n return str.replace(/[-_](\\w)/g, (_, c) => c.toUpperCase()).replace(/^\\w/, (c) => c.toUpperCase());\n}\n\nexport { oxContent, renderHead } from \"@ox-content/vite-plugin\";\nexport type { HeadInput, RenderedHead } from \"@ox-content/vite-plugin\";\n"],"mappings":";;;;;AAiBA,MAAM,kBAAkB;AACxB,MAAM,aAAa;AAEnB,MAAM,uBAAuB;AAC7B,MAAM,uBAAuB;AAC7B,MAAM,8BAA8B;AACpC,MAAM,8BAA8B;AACpC,MAAM,iBAAiB;AACvB,MAAM,oCAAoB,IAAI,IAAI;CAAC;CAAS;CAAe;AAAS,CAAC;AAOrE,eAAsB,4BACpB,MACA,IACA,SACgC;CAChC,MAAM,aAA4B,QAAQ;CAC1C,MAAM,EAAE,SAAS,iBAAiB,gBAAgB,mBAAmB,IAAI;CACzE,MAAM,MAAM,sBAAsB,IAAI,QAAQ,GAAG;CAEjD,MAAM,cAAc;EAClB,QAAQ,QAAQ;EAChB,QAAQ,QAAQ;EAChB,MAAM,QAAQ;EACd,YAAY,QAAQ;EACpB;EACA,KAAK;GACH,SAAS;GACT,WAAW;GACX,OAAO;GACP,MAAM;GACN,iBAAiB;GACjB,aAAa;GACb,YAAY;GACZ,aAAa;GACb,QAAQ;GACR,cAAc;GACd,gBAAgB;GAChB,MAAM;GACN,YAAY;EACd;EACA,KAAK,QAAQ;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,SAAS,GAAG,GAClD,MAAM,KAAK,QAAQ;CAEvB;AACF;AAEA,SAAS,aAAa,KAAqB;CACzC,OAAO,IAAI,QAAQ,cAAc,GAAG,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,QAAQ,QAAQ,MAAM,EAAE,YAAY,CAAC;AAClG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ox-content/vite-plugin-svelte",
3
- "version": "3.0.0-alpha.16",
3
+ "version": "3.0.0-alpha.18",
4
4
  "description": "Svelte integration for Ox Content - Embed Svelte components in Markdown",
5
5
  "keywords": [
6
6
  "markdown",
@@ -34,8 +34,8 @@
34
34
  "provenance": true
35
35
  },
36
36
  "dependencies": {
37
- "@ox-content/islands": "3.0.0-alpha.16",
38
- "@ox-content/vite-plugin": "3.0.0-alpha.16"
37
+ "@ox-content/islands": "3.0.0-alpha.18",
38
+ "@ox-content/vite-plugin": "3.0.0-alpha.18"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@sveltejs/vite-plugin-svelte": "^7.2.0",