@tenphi/starlight 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -598,30 +598,6 @@ export default function GlobalStyles() {
598
598
  fill: "#surface-2",
599
599
  });
600
600
 
601
- useGlobalStyles(".td-shell__main img", {
602
- maxInlineSize: "100%",
603
- blockSize: "auto",
604
- radius: "$radius",
605
- });
606
-
607
- useGlobalStyles(".td-shell__main :where(pre, table)", {
608
- maxInlineSize: "100%",
609
- overflow: "auto",
610
- });
611
-
612
- useGlobalStyles(".td-shell__main :where(pre):not(:where(.td-preview *))", {
613
- padding: "($gap * 1.5) ($gap * 2)",
614
- fontSize: "$code-font-size",
615
- lineHeight: "$code-line-height",
616
- letterSpacing: "$code-letter-spacing",
617
- border: true,
618
- radius: "$card-radius",
619
- });
620
-
621
- useGlobalStyles(".td-shell__main a", {
622
- color: "#accent-text",
623
- });
624
-
625
601
  useGlobalStyles(":root, :root:has(.td-top-tabs)", {
626
602
  "$sl-nav-height": {
627
603
  "@mobile": "3.5rem",
@@ -1,13 +1,5 @@
1
1
  import { tasty } from "@tenphi/tasty";
2
- import chevronDownIcon from "../icons/chevron-down.svg?raw";
3
- import closeIcon from "../icons/close.svg?raw";
4
- import contrastIcon from "../icons/contrast.svg?raw";
5
- import deviceIcon from "../icons/device-desktop.svg?raw";
6
- import moonIcon from "../icons/moon.svg?raw";
7
- import searchIcon from "../icons/search.svg?raw";
8
- import sunIcon from "../icons/sun.svg?raw";
9
2
  import { customizeComponent } from "./customize-component.js";
10
- import { svgIconUrl } from "./svg-icon.js";
11
3
  import { configureCookbookStates } from "./tasty-states.js";
12
4
 
13
5
  configureCookbookStates();
@@ -410,343 +402,3 @@ export const MobileMenuFooterRoot = customizeComponent(
410
402
  },
411
403
  }),
412
404
  );
413
-
414
- export const NavigationTreeRoot = customizeComponent(
415
- "NavigationTree",
416
- { as: "ul" },
417
- tasty({
418
- as: "ul",
419
- styles: {
420
- margin: "0",
421
- padding: "0",
422
- listStyle: "none",
423
- NestedList: {
424
- $: "ul",
425
- margin: "0",
426
- padding: "0 0 0 ($gap * 1.5)",
427
- listStyle: "none",
428
- },
429
- Summary: {
430
- $: "details > summary",
431
- display: "flex",
432
- alignItems: "center",
433
- justifyContent: "space-between",
434
- padding: "($gap * 0.9) ($gap * 1.25)",
435
- color: "#text",
436
- preset: "body / strong",
437
- cursor: "pointer",
438
- listStyle: "none",
439
- },
440
- Marker: { $: "details > summary::-webkit-details-marker", hide: true },
441
- SummaryIcon: {
442
- $: "details > summary::after",
443
- content: '""',
444
- inlineSize: "1rem",
445
- blockSize: "1rem",
446
- fill: "#text-soft",
447
- mask: `url("${svgIconUrl(chevronDownIcon)}") center / contain no-repeat`,
448
- },
449
- ClosedSummaryIcon: {
450
- $: "details:not([open]) > summary::after",
451
- rotate: "-90deg",
452
- },
453
- Link: {
454
- $: "a",
455
- display: "block",
456
- padding: "($gap * 0.9) ($gap * 1.25)",
457
- color: "#text-soft",
458
- radius: "$radius",
459
- textDecoration: "none",
460
- },
461
- HoverLink: { $: "a:hover", color: "#text", fill: "#surface-2" },
462
- CurrentLink: {
463
- $: 'a[aria-current="page"]',
464
- color: "#accent-text",
465
- preset: "body / strong",
466
- fill: "color-mix(in oklab, #accent-surface 12%, #surface)",
467
- },
468
- },
469
- }),
470
- );
471
-
472
- export const StandaloneHeaderRoot = customizeComponent(
473
- "StandaloneHeader",
474
- { as: "header" },
475
- tasty({
476
- as: "header",
477
- styles: {
478
- position: "sticky",
479
- inset: "0 top",
480
- zIndex: "2",
481
- display: "flex",
482
- flow: "column",
483
- paddingInline: {
484
- "": "clamp(1.25rem, 3vw, 2rem)",
485
- "@shell-mobile": "1rem",
486
- },
487
- fill: "color-mix(in oklab, #surface 96%, #clear)",
488
- backdropFilter: "blur(12px)",
489
- border: { "": "0", "@desktop": "1bw bottom" },
490
- Primary: {
491
- $: ".td-shell__header-primary",
492
- display: "flex",
493
- alignItems: "center",
494
- justifyContent: "space-between",
495
- gap: "($gap * 3)",
496
- inlineSize: "100%",
497
- maxInlineSize: "($layout-width - ($gap * 6))",
498
- minBlockSize: "4.5rem",
499
- marginInlineStart: "auto",
500
- marginInlineEnd: "auto",
501
- },
502
- Brand: {
503
- $: ".td-shell__brand",
504
- display: "flex",
505
- alignItems: "center",
506
- gap: "$gap",
507
- minInlineSize: "0",
508
- },
509
- BrandLink: {
510
- $: ".td-shell__brand > a",
511
- color: "#text",
512
- preset: "heading",
513
- textDecoration: "none",
514
- },
515
- Actions: {
516
- $: ".td-shell__actions",
517
- display: "flex",
518
- alignItems: { "": "center", "@shell-mobile": "stretch" },
519
- flow: { "": "row nowrap", "@shell-mobile": "row wrap" },
520
- gap: "$gap",
521
- },
522
- TopNavigation: {
523
- $: "> .td-top-tabs",
524
- maxInlineSize: "($layout-width - ($gap * 6))",
525
- marginInlineStart: "auto",
526
- marginInlineEnd: "auto",
527
- },
528
- },
529
- }),
530
- );
531
-
532
- export const AppearanceControlRoot = customizeComponent(
533
- "AppearanceControl",
534
- { as: "label" },
535
- tasty({
536
- as: "label",
537
- styles: {
538
- position: "relative",
539
- display: "grid",
540
- placeItems: "center",
541
- inlineSize: "$control-height",
542
- blockSize: "$control-height",
543
- radius: "$radius",
544
- fill: { "": "#surface-2", ":hover": "#surface-2-hover" },
545
- Select: {
546
- $: "select",
547
- position: "absolute",
548
- inset: "0",
549
- inlineSize: "100%",
550
- blockSize: "100%",
551
- padding: "0",
552
- border: "0",
553
- opacity: "0",
554
- cursor: "pointer",
555
- },
556
- Icon: {
557
- $: "&::before",
558
- content: '""',
559
- inlineSize: "1rem",
560
- blockSize: "1rem",
561
- fill: "#text-soft",
562
- mask: {
563
- "": `url("${svgIconUrl(deviceIcon)}") center / contain no-repeat`,
564
- ':has([data-docs-theme] option[value="light"]:checked)': `url("${svgIconUrl(sunIcon)}") center / contain no-repeat`,
565
- ':has([data-docs-theme] option[value="dark"]:checked)': `url("${svgIconUrl(moonIcon)}") center / contain no-repeat`,
566
- ".td-appearance-control--contrast": `url("${svgIconUrl(contrastIcon)}") center / contain no-repeat`,
567
- },
568
- pointerEvents: "none",
569
- },
570
- },
571
- }),
572
- );
573
-
574
- export const SearchTriggerRoot = customizeComponent(
575
- "SearchTrigger",
576
- { as: "button" },
577
- tasty({
578
- as: "button",
579
- styles: {
580
- display: "inline-flex",
581
- alignItems: "center",
582
- gap: "$gap",
583
- paddingInline: "($gap * 1.5)",
584
- color: "#text",
585
- border: true,
586
- radius: "$radius",
587
- fill: {
588
- "": "#surface-2",
589
- ":hover": "#surface-2-hover",
590
- ":active": "#surface-2-pressed",
591
- },
592
- transition: "fill 120ms ease",
593
- Icon: {
594
- $: "&::before",
595
- content: '""',
596
- inlineSize: "1rem",
597
- blockSize: "1rem",
598
- flexGrow: "0",
599
- flexShrink: "0",
600
- flexBasis: "auto",
601
- fill: "#current",
602
- mask: `url("${svgIconUrl(searchIcon)}") center / contain no-repeat`,
603
- },
604
- Shortcut: {
605
- $: "> kbd",
606
- display: "flex",
607
- gap: "0.125rem",
608
- marginInlineStart: "($gap * 1.5)",
609
- color: "#text-soft",
610
- preset: "small",
611
- font: "$body-font-family",
612
- },
613
- Key: { $: "kbd", font: "$body-font-family" },
614
- },
615
- }),
616
- );
617
-
618
- export const DocsLayoutRoot = customizeComponent(
619
- "DocsLayout",
620
- { as: "div" },
621
- tasty({
622
- as: "div",
623
- styles: {
624
- display: "grid",
625
- gridColumns: {
626
- "": "minmax(13rem, $sidebar-width) minmax(0, 1fr)",
627
- "@shell-mobile": "1fr",
628
- },
629
- inlineSize: "min(100%, $layout-width)",
630
- minBlockSize: "100vh",
631
- marginInlineStart: "auto",
632
- marginInlineEnd: "auto",
633
- },
634
- }),
635
- );
636
-
637
- export const DocsSidebarRoot = customizeComponent(
638
- "DocsSidebar",
639
- { as: "nav" },
640
- tasty({
641
- as: "nav",
642
- styles: {
643
- padding: {
644
- "": "($gap * 5) ($gap * 3)",
645
- "@shell-mobile": "($gap * 2) ($gap * 3)",
646
- },
647
- },
648
- }),
649
- );
650
-
651
- export const DocsArticleRoot = customizeComponent(
652
- "DocsArticle",
653
- { as: "main" },
654
- tasty({
655
- as: "main",
656
- styles: {
657
- inlineSize: "min(100%, $content-width)",
658
- padding: "($gap * 3) clamp(1.5rem, 5vw, 4rem) ($gap * 10)",
659
- },
660
- }),
661
- );
662
-
663
- export const SearchDialogRoot = customizeComponent(
664
- "SearchDialog",
665
- { as: "dialog" },
666
- tasty({
667
- as: "dialog",
668
- styles: {
669
- inlineSize: "min(42rem, calc(100% - 2rem))",
670
- padding: "($gap * 2.5)",
671
- color: "#text",
672
- fill: "#surface",
673
- border: "$border-width solid #border-strong",
674
- radius: "$card-radius",
675
- shadow: "$sl-shadow-lg",
676
- Backdrop: { $: "&::backdrop", fill: "#overlay" },
677
- Form: { $: "form", float: "inline-end" },
678
- LabelAndInput: {
679
- $: "label, input",
680
- display: "block",
681
- inlineSize: "100%",
682
- },
683
- Input: {
684
- $: "input",
685
- marginBlock: "$gap ($gap * 2)",
686
- paddingInline: "($gap * 1.5)",
687
- color: "#text",
688
- border: true,
689
- radius: "$radius",
690
- fill: "#surface",
691
- },
692
- Close: {
693
- $: 'button[aria-label="Close search"]',
694
- display: "grid",
695
- placeItems: "center",
696
- inlineSize: "$control-height",
697
- padding: "0",
698
- overflow: "hidden",
699
- color: "#clear",
700
- border: true,
701
- radius: "$radius",
702
- fill: {
703
- "": "#surface-2",
704
- ":hover": "#surface-2-hover",
705
- ":active": "#surface-2-pressed",
706
- },
707
- },
708
- CloseIcon: {
709
- $: 'button[aria-label="Close search"]::before',
710
- content: '""',
711
- inlineSize: "1rem",
712
- blockSize: "1rem",
713
- color: "#text",
714
- fill: "#current",
715
- mask: `url("${svgIconUrl(closeIcon)}") center / contain no-repeat`,
716
- },
717
- },
718
- }),
719
- );
720
-
721
- export const SkipLinkRoot = customizeComponent(
722
- "SkipLink",
723
- { as: "a" },
724
- tasty({
725
- as: "a",
726
- styles: {
727
- position: "fixed",
728
- inset: "$gap auto auto $gap",
729
- zIndex: "4",
730
- translate: { "": "0 -150%", ":focus": "0" },
731
- padding: "$gap ($gap * 1.5)",
732
- color: "#accent-surface-text",
733
- radius: "$radius",
734
- fill: "#accent-surface",
735
- },
736
- }),
737
- );
738
-
739
- export const VisuallyHiddenRoot = tasty({
740
- as: "span",
741
- styles: {
742
- position: "absolute",
743
- inlineSize: "1px",
744
- blockSize: "1px",
745
- padding: "0",
746
- margin: "-1px",
747
- overflow: "hidden",
748
- clip: "rect(0, 0, 0, 0)",
749
- whiteSpace: "nowrap",
750
- border: "0",
751
- },
752
- });
package/dist/index.d.ts CHANGED
@@ -6,6 +6,7 @@ interface StarlightOptions {
6
6
  title: string;
7
7
  description?: string;
8
8
  customCss?: string[];
9
+ disable404Route?: boolean;
9
10
  pagefind?: false | Record<string, unknown>;
10
11
  sidebar?: unknown[];
11
12
  [key: string]: unknown;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/starlight-runtime.d.ts","../src/integration.ts","../src/theme/index.ts","../src/theme/defaults.ts"],"mappings":";;;;UAEiB;EACf;EACA;EACA;EACA,mBAAmB;EACnB;GACC;;iBAGqB,UAAU,SAAS,mBAAmB;;;UCoC7C;EACf,SAAS;EACT;;iBAGsB,SACtB,UAAS,kBACR;iBAsaa,eACd,QAAQ,kBAAkB,gBACzB;;;UC5cc;EACf;IACE,SAAS;IACT,UAAU;IACV,UAAU;IACV,MAAM;IACN,UAAU;IACV,YAAY;IACZ,eAAe;IACf,mBAAmB;IACnB,OAAO;IACP,QAAQ;;EAEV,QAAQ;EACR,SAAS,eAAe;EACxB;IACE;IACA;IACA;IACA;;EAEF,aAAa;;iBAGC,iBAAiB,QAAO,cAAmB;;;cCpC9C;;;;;;;;;;;;cAkBA,4BAA4B,eAAe"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/starlight-runtime.d.ts","../src/integration.ts","../src/theme/index.ts","../src/theme/defaults.ts"],"mappings":";;;;UAEiB;EACf;EACA;EACA;EACA;EACA,mBAAmB;EACnB;GACC;;iBAGqB,UAAU,SAAS,mBAAmB;;;UCmC7C;EACf,SAAS;EACT;;iBAGsB,SACtB,UAAS,kBACR;iBA4aa,eACd,QAAQ,kBAAkB,gBACzB;;;UCldc;EACf;IACE,SAAS;IACT,UAAU;IACV,UAAU;IACV,MAAM;IACN,UAAU;IACV,YAAY;IACZ,eAAe;IACf,mBAAmB;IACnB,OAAO;IACP,QAAQ;;EAEV,QAAQ;EACR,SAAS,eAAe;EACxB;IACE;IACA;IACA;IACA;;EAEF,aAAa;;iBAGC,iBAAiB,QAAO,cAAmB;;;cCpC9C;;;;;;;;;;;;cAkBA,4BAA4B,eAAe"}
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { n as starlight, t as createStarlightCollection } from "./content-Cwk8rm6i.js";
2
- import { a as resolveNavigationLayout } from "./navigation-CC0dlAL8.js";
2
+ import { a as resolveNavigationLayout } from "./navigation-CkQXI2Zb.js";
3
3
  import { createRequire } from "node:module";
4
4
  import { existsSync } from "node:fs";
5
5
  import { cp, mkdir, readFile } from "node:fs/promises";
@@ -334,8 +334,6 @@ function cookbook(options = {}) {
334
334
  if (docsTheme.diagnostics.some((diagnostic) => diagnostic.severity === "error")) throw new Error(docsTheme.diagnostics.map((diagnostic) => diagnostic.message).join("\n"));
335
335
  configureTastyTheme(options.config?.theme, docsTheme);
336
336
  configureComponentStyles(options.config?.theme?.styles);
337
- const searchClientPath = fileURLToPath(new URL("./client/search.js", import.meta.url));
338
- const appearanceClientPath = fileURLToPath(new URL("./client/appearance.js", import.meta.url));
339
337
  const components = {
340
338
  Header: fileURLToPath(new URL("./overrides/Header.astro", import.meta.url)),
341
339
  Sidebar: fileURLToPath(new URL("./overrides/Sidebar.astro", import.meta.url)),
@@ -348,18 +346,11 @@ function cookbook(options = {}) {
348
346
  islands: false,
349
347
  css: { mode: "extract" }
350
348
  });
351
- const starlightIntegration = starlight({
352
- title: options.config?.site?.title ?? "Documentation",
353
- ...options.config?.site?.description ? { description: options.config.site.description } : {},
354
- ...options.config?.search?.enabled === false ? { pagefind: false } : {},
355
- components,
356
- sidebar: starlightSidebar(navigation)
357
- });
358
- let inner = [tasty, starlightIntegration];
349
+ let inner = [tasty];
359
350
  let projectRoot = options.root;
360
351
  let graphConfig = options.config;
361
352
  let graph;
362
- let usingStarlight = false;
353
+ let usingContentCollection = false;
363
354
  async function loadGraph(refresh = false) {
364
355
  if (!graph || refresh) {
365
356
  graph = await createDocsGraph({
@@ -374,11 +365,7 @@ function cookbook(options = {}) {
374
365
  name: "cookbook",
375
366
  hooks: {
376
367
  "astro:config:setup": async (context) => {
377
- inner = [
378
- (await importNative(pathToFileURL(astroReactIntegration).href)).default(),
379
- tasty,
380
- starlightIntegration
381
- ];
368
+ const react = (await importNative(pathToFileURL(astroReactIntegration).href)).default();
382
369
  if (context.config.integrations.some((integration) => integration.name === "@astrojs/starlight")) throw new Error("Cookbook already includes Starlight. Remove the direct @astrojs/starlight integration before continuing.");
383
370
  projectRoot ??= fileURLToPath(context.config.root);
384
371
  const base = options.config?.build?.base ?? context.config.base;
@@ -389,7 +376,26 @@ function cookbook(options = {}) {
389
376
  base
390
377
  }
391
378
  };
392
- usingStarlight = hasContentConfig(context.config.srcDir);
379
+ usingContentCollection = hasContentConfig(context.config.srcDir);
380
+ const starlightIntegration = starlight({
381
+ title: options.config?.site?.title ?? "Documentation",
382
+ ...options.config?.site?.description ? { description: options.config.site.description } : {},
383
+ ...options.config?.search?.enabled === false ? { pagefind: false } : {},
384
+ ...!usingContentCollection ? { disable404Route: true } : {},
385
+ components,
386
+ sidebar: usingContentCollection ? starlightSidebar(navigation) : []
387
+ });
388
+ inner = [
389
+ react,
390
+ tasty,
391
+ starlightIntegration
392
+ ];
393
+ let markdownRuntime = {
394
+ image: context.config.image,
395
+ markdown: context.config.markdown,
396
+ srcDir: context.config.srcDir
397
+ };
398
+ let markdownRenderer;
393
399
  context.updateConfig({
394
400
  base,
395
401
  output: "static",
@@ -403,7 +409,27 @@ function cookbook(options = {}) {
403
409
  plugins: [virtualDocsPlugin(async () => {
404
410
  const loaded = await loadGraph();
405
411
  return {
406
- entries: loaded.entries,
412
+ entries: usingContentCollection ? loaded.entries : await Promise.all(loaded.entries.map(async (entry) => {
413
+ const { image, markdown, srcDir } = markdownRuntime;
414
+ markdownRenderer ??= markdown.processor.createRenderer({
415
+ image,
416
+ syntaxHighlight: markdown.syntaxHighlight,
417
+ shikiConfig: markdown.shikiConfig,
418
+ gfm: markdown.gfm,
419
+ smartypants: markdown.smartypants
420
+ });
421
+ const rendered = await (await markdownRenderer).render(entry.transformedBody, {
422
+ frontmatter: entry.frontmatter,
423
+ fileURL: starlightContentUrl(entry.route, srcDir)
424
+ });
425
+ return {
426
+ ...entry,
427
+ rendered: {
428
+ html: rendered.code,
429
+ headings: rendered.metadata.headings
430
+ }
431
+ };
432
+ })),
407
433
  routes: loaded.routes,
408
434
  site: documentedSite(loaded),
409
435
  base: loaded.config.build.base,
@@ -435,35 +461,42 @@ function cookbook(options = {}) {
435
461
  }
436
462
  });
437
463
  await callInner(inner.slice(0, 2), "astro:config:setup", context);
438
- if (!usingStarlight) {
464
+ if (!usingContentCollection) {
439
465
  graph = await createDocsGraph({
440
466
  root: projectRoot,
441
467
  config: graphConfig
442
468
  });
443
469
  assertValidDocs(graph);
444
- if (graph.config.search.enabled) context.injectScript("page", `import ${JSON.stringify(searchClientPath)};`);
445
- context.injectScript("page", `import ${JSON.stringify(appearanceClientPath)};`);
446
470
  context.injectRoute({
447
471
  pattern: "[...route]",
448
472
  entrypoint: new URL("./routes/DocsPage.astro", import.meta.url),
449
473
  prerender: true
450
474
  });
451
- return;
452
475
  }
453
476
  const starlightWithPlugins = inner[2];
454
477
  if (starlightWithPlugins) {
455
478
  const selfIndex = context.config.integrations.findIndex((integration) => integration.name === "cookbook");
456
479
  context.config.integrations.splice(selfIndex + 1, 0, starlightWithPlugins);
457
480
  try {
458
- await callInner([starlightWithPlugins], "astro:config:setup", context);
481
+ await callInner([starlightWithPlugins], "astro:config:setup", usingContentCollection ? context : withoutStarlightDocsRoute(context));
459
482
  } finally {
460
483
  const placeholderIndex = context.config.integrations.indexOf(starlightWithPlugins);
461
484
  if (placeholderIndex >= 0) context.config.integrations.splice(placeholderIndex, 1);
462
485
  }
463
486
  }
487
+ context.config.integrations.push({
488
+ name: "cookbook-markdown-renderer",
489
+ hooks: { "astro:config:setup": ({ config }) => {
490
+ markdownRuntime = {
491
+ image: config.image,
492
+ markdown: config.markdown,
493
+ srcDir: config.srcDir
494
+ };
495
+ } }
496
+ });
464
497
  },
465
498
  "astro:config:done": async (context) => {
466
- await callInner(usingStarlight ? inner : inner.slice(0, 2), "astro:config:done", context);
499
+ await callInner(inner, "astro:config:done", context);
467
500
  },
468
501
  "astro:server:setup": async ({ server }) => {
469
502
  let assets = docsAssetMap(await loadGraph());
@@ -505,10 +538,10 @@ function cookbook(options = {}) {
505
538
  },
506
539
  "astro:build:start": async (context) => {
507
540
  await loadGraph();
508
- await callInner(usingStarlight ? inner : inner.slice(0, 2), "astro:build:start", context);
541
+ await callInner(inner, "astro:build:start", context);
509
542
  },
510
543
  "astro:build:done": async (context) => {
511
- await callInner(usingStarlight ? inner : inner.slice(0, 2), "astro:build:done", context);
544
+ await callInner(inner, "astro:build:done", context);
512
545
  if (!graph) return;
513
546
  const output = fileURLToPath(context.dir);
514
547
  for (const asset of graph.assets) {
@@ -517,20 +550,14 @@ function cookbook(options = {}) {
517
550
  await mkdir(dirname(target), { recursive: true });
518
551
  await cp(asset.sourcePath, target);
519
552
  }
520
- if (!usingStarlight && graph.config.search.enabled) {
521
- const { close, createIndex } = await import("pagefind");
522
- const created = await createIndex({ rootSelector: "[data-pagefind-body]" });
523
- if (!created.index || created.errors.length > 0) throw new Error(`Pagefind failed to start: ${created.errors.join("; ")}`);
524
- const indexed = await created.index.addDirectory({ path: output });
525
- if (indexed.errors.length > 0) throw new Error(`Pagefind failed to index the site: ${indexed.errors.join("; ")}`);
526
- const written = await created.index.writeFiles({ outputPath: join(output, "pagefind") });
527
- await close();
528
- if (written.errors.length > 0) throw new Error(`Pagefind failed to write the index: ${written.errors.join("; ")}`);
529
- }
530
553
  }
531
554
  }
532
555
  };
533
556
  }
557
+ function starlightContentUrl(route, srcDir) {
558
+ const slug = route === "/" ? "index" : route.replace(/^\/+|\/+$/g, "");
559
+ return new URL(`content/docs/${slug}.md`, srcDir);
560
+ }
534
561
  function docsAssetMap(graph) {
535
562
  return new Map(graph.assets.flatMap((asset) => asset.publicPath && asset.sourcePath ? [[asset.publicPath, asset]] : []));
536
563
  }
@@ -618,6 +645,14 @@ async function callInner(integrations, hook, context) {
618
645
  if (typeof handler === "function") await handler(context);
619
646
  }
620
647
  }
648
+ function withoutStarlightDocsRoute(context) {
649
+ return new Proxy(context, { get(target, property, receiver) {
650
+ if (property !== "injectRoute") return Reflect.get(target, property, receiver);
651
+ return (route) => {
652
+ if (route.pattern !== "[...slug]") context.injectRoute(route);
653
+ };
654
+ } });
655
+ }
621
656
  function virtualDocsPlugin(getContent, layout) {
622
657
  const configId = "\0virtual:cookbook/config";
623
658
  const layoutId = "\0virtual:cookbook/layout";