svelte-docsmith 0.5.1 → 0.7.0
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/README.md +6 -2
- package/dist/{markdown-layout.svelte → buildtime/markdown-layout.svelte} +1 -1
- package/dist/{markdown-layout.svelte.d.ts → buildtime/markdown-layout.svelte.d.ts} +2 -2
- package/dist/{vite.d.ts → buildtime/vite/collect.d.ts} +5 -23
- package/dist/buildtime/vite/collect.js +101 -0
- package/dist/buildtime/vite/extract.d.ts +30 -0
- package/dist/buildtime/vite/extract.js +104 -0
- package/dist/buildtime/vite/frontmatter.d.ts +6 -0
- package/dist/buildtime/vite/frontmatter.js +20 -0
- package/dist/buildtime/vite/git.d.ts +2 -0
- package/dist/buildtime/vite/git.js +11 -0
- package/dist/buildtime/vite/index.d.ts +25 -0
- package/dist/buildtime/vite/index.js +141 -0
- package/dist/buildtime/vite/pages.d.ts +6 -0
- package/dist/buildtime/vite/pages.js +23 -0
- package/dist/{ui → components/chrome}/copy-button.svelte +1 -1
- package/dist/{ui → components/chrome}/search-trigger.svelte +1 -1
- package/dist/{ui → components/chrome}/search.svelte +5 -5
- package/dist/{ui → components/chrome}/search.svelte.d.ts +1 -1
- package/dist/{ui → components/chrome}/table-of-contents.svelte +2 -2
- package/dist/{ui → components/chrome}/table-of-contents.svelte.d.ts +1 -1
- package/dist/{ui → components/chrome}/theme-toggle.svelte +1 -1
- package/dist/{ui → components/docs}/accordion-item.svelte +1 -1
- package/dist/{ui → components/docs}/accordion.svelte +1 -1
- package/dist/{ui → components/docs}/badge.svelte +1 -1
- package/dist/{ui → components/docs}/live-example.svelte +3 -3
- package/dist/{ui → components/docs}/tab-item.svelte +1 -1
- package/dist/{ui → components/docs}/tabs.svelte +1 -1
- package/dist/{ui → components}/layouts/docs-footer.svelte +1 -1
- package/dist/{ui → components}/layouts/docs-footer.svelte.d.ts +1 -1
- package/dist/{ui → components}/layouts/docs-header.svelte +3 -3
- package/dist/{ui → components}/layouts/docs-header.svelte.d.ts +1 -1
- package/dist/{ui → components}/layouts/docs-mobile-header.svelte +3 -3
- package/dist/{ui → components}/layouts/docs-mobile-header.svelte.d.ts +1 -1
- package/dist/{ui → components}/layouts/docs-shell.svelte +44 -10
- package/dist/{ui → components}/layouts/docs-shell.svelte.d.ts +12 -1
- package/dist/{ui → components}/layouts/docs-sidebar.svelte +3 -3
- package/dist/{ui → components}/layouts/docs-sidebar.svelte.d.ts +1 -1
- package/dist/{ui → components}/layouts/error-page.svelte +1 -1
- package/dist/{ui → components}/layouts/error-page.svelte.d.ts +1 -1
- package/dist/components/layouts/page-feedback.svelte +51 -0
- package/dist/components/layouts/page-feedback.svelte.d.ts +9 -0
- package/dist/{ui → components}/layouts/prev-next-nav.svelte +1 -1
- package/dist/{ui → components}/layouts/prev-next-nav.svelte.d.ts +1 -1
- package/dist/{ui → components}/layouts/seo-head.svelte +2 -2
- package/dist/{ui → components}/layouts/seo-head.svelte.d.ts +1 -1
- package/dist/{ui → components}/markdown/pre.svelte +2 -2
- package/dist/{ui → components}/markdown/types.d.ts +1 -1
- package/dist/{ui → components}/shadcn/accordion/accordion-content.svelte +1 -1
- package/dist/{ui → components}/shadcn/accordion/accordion-item.svelte +1 -1
- package/dist/{ui → components}/shadcn/accordion/accordion-trigger.svelte +1 -1
- package/dist/{ui → components}/shadcn/accordion/accordion-trigger.svelte.d.ts +1 -1
- package/dist/{ui → components}/shadcn/accordion/accordion.svelte +1 -1
- package/dist/{ui → components}/shadcn/badge/badge.svelte +1 -1
- package/dist/{ui → components}/shadcn/badge/badge.svelte.d.ts +1 -1
- package/dist/{ui → components}/shadcn/button/button.svelte +1 -1
- package/dist/{ui → components}/shadcn/button/button.svelte.d.ts +1 -1
- package/dist/{ui → components}/shadcn/command/command-dialog.svelte +1 -1
- package/dist/{ui → components}/shadcn/command/command-dialog.svelte.d.ts +1 -1
- package/dist/{ui → components}/shadcn/command/command-empty.svelte +1 -1
- package/dist/{ui → components}/shadcn/command/command-group.svelte +1 -1
- package/dist/{ui → components}/shadcn/command/command-input.svelte +1 -1
- package/dist/{ui → components}/shadcn/command/command-item.svelte +1 -1
- package/dist/{ui → components}/shadcn/command/command-link-item.svelte +1 -1
- package/dist/{ui → components}/shadcn/command/command-list.svelte +1 -1
- package/dist/{ui → components}/shadcn/command/command-separator.svelte +1 -1
- package/dist/{ui → components}/shadcn/command/command-shortcut.svelte +1 -1
- package/dist/{ui → components}/shadcn/command/command-shortcut.svelte.d.ts +1 -1
- package/dist/{ui → components}/shadcn/command/command.svelte +1 -1
- package/dist/{ui → components}/shadcn/dialog/dialog-content.svelte +1 -1
- package/dist/{ui → components}/shadcn/dialog/dialog-content.svelte.d.ts +1 -1
- package/dist/{ui → components}/shadcn/dialog/dialog-description.svelte +1 -1
- package/dist/{ui → components}/shadcn/dialog/dialog-footer.svelte +1 -1
- package/dist/{ui → components}/shadcn/dialog/dialog-footer.svelte.d.ts +1 -1
- package/dist/{ui → components}/shadcn/dialog/dialog-header.svelte +1 -1
- package/dist/{ui → components}/shadcn/dialog/dialog-header.svelte.d.ts +1 -1
- package/dist/{ui → components}/shadcn/dialog/dialog-overlay.svelte +1 -1
- package/dist/{ui → components}/shadcn/dialog/dialog-title.svelte +1 -1
- package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-checkbox-item.svelte +1 -1
- package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-checkbox-item.svelte.d.ts +1 -1
- package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-content.svelte +1 -1
- package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-content.svelte.d.ts +1 -1
- package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-group-heading.svelte +1 -1
- package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-item.svelte +1 -1
- package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-label.svelte +1 -1
- package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-label.svelte.d.ts +1 -1
- package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-radio-item.svelte +1 -1
- package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-separator.svelte +1 -1
- package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-shortcut.svelte +1 -1
- package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-shortcut.svelte.d.ts +1 -1
- package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-sub-content.svelte +1 -1
- package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-sub-trigger.svelte +1 -1
- package/dist/{ui → components}/shadcn/input/input.svelte +1 -1
- package/dist/{ui → components}/shadcn/input/input.svelte.d.ts +1 -1
- package/dist/{ui → components}/shadcn/input-group/input-group-addon.svelte +1 -1
- package/dist/{ui → components}/shadcn/input-group/input-group-addon.svelte.d.ts +1 -1
- package/dist/{ui → components}/shadcn/input-group/input-group-button.svelte +1 -1
- package/dist/{ui → components}/shadcn/input-group/input-group-input.svelte +1 -1
- package/dist/{ui → components}/shadcn/input-group/input-group-input.svelte.d.ts +1 -1
- package/dist/{ui → components}/shadcn/input-group/input-group-text.svelte +1 -1
- package/dist/{ui → components}/shadcn/input-group/input-group-text.svelte.d.ts +1 -1
- package/dist/{ui → components}/shadcn/input-group/input-group-textarea.svelte +1 -1
- package/dist/{ui → components}/shadcn/input-group/input-group-textarea.svelte.d.ts +1 -1
- package/dist/{ui → components}/shadcn/input-group/input-group.svelte +1 -1
- package/dist/{ui → components}/shadcn/input-group/input-group.svelte.d.ts +1 -1
- package/dist/{ui → components}/shadcn/popover/popover-content.svelte +1 -1
- package/dist/{ui → components}/shadcn/popover/popover-content.svelte.d.ts +1 -1
- package/dist/{ui → components}/shadcn/popover/popover-description.svelte +1 -1
- package/dist/{ui → components}/shadcn/popover/popover-description.svelte.d.ts +1 -1
- package/dist/{ui → components}/shadcn/popover/popover-header.svelte +1 -1
- package/dist/{ui → components}/shadcn/popover/popover-header.svelte.d.ts +1 -1
- package/dist/{ui → components}/shadcn/popover/popover-title.svelte +1 -1
- package/dist/{ui → components}/shadcn/popover/popover-title.svelte.d.ts +1 -1
- package/dist/{ui → components}/shadcn/popover/popover-trigger.svelte +1 -1
- package/dist/{ui → components}/shadcn/scroll-area/scroll-area-scrollbar.svelte +1 -1
- package/dist/{ui → components}/shadcn/scroll-area/scroll-area.svelte +1 -1
- package/dist/{ui → components}/shadcn/scroll-area/scroll-area.svelte.d.ts +1 -1
- package/dist/{ui → components}/shadcn/separator/separator.svelte +1 -1
- package/dist/{ui → components}/shadcn/sheet/sheet-content.svelte +1 -1
- package/dist/{ui → components}/shadcn/sheet/sheet-content.svelte.d.ts +1 -1
- package/dist/{ui → components}/shadcn/sheet/sheet-description.svelte +1 -1
- package/dist/{ui → components}/shadcn/sheet/sheet-footer.svelte +1 -1
- package/dist/{ui → components}/shadcn/sheet/sheet-footer.svelte.d.ts +1 -1
- package/dist/{ui → components}/shadcn/sheet/sheet-header.svelte +1 -1
- package/dist/{ui → components}/shadcn/sheet/sheet-header.svelte.d.ts +1 -1
- package/dist/{ui → components}/shadcn/sheet/sheet-overlay.svelte +1 -1
- package/dist/{ui → components}/shadcn/sheet/sheet-title.svelte +1 -1
- package/dist/{ui → components}/shadcn/tabs/tabs-content.svelte +1 -1
- package/dist/{ui → components}/shadcn/tabs/tabs-list.svelte +1 -1
- package/dist/{ui → components}/shadcn/tabs/tabs-trigger.svelte +1 -1
- package/dist/{ui → components}/shadcn/tabs/tabs.svelte +1 -1
- package/dist/{ui → components}/shadcn/textarea/textarea.svelte +1 -1
- package/dist/{ui → components}/shadcn/textarea/textarea.svelte.d.ts +1 -1
- package/dist/core/config.d.ts +65 -0
- package/dist/{config.js → core/config.js} +0 -22
- package/dist/core/content.d.ts +68 -0
- package/dist/core/content.js +7 -0
- package/dist/core/index.d.ts +3 -0
- package/dist/core/index.js +6 -0
- package/dist/core/nav.d.ts +17 -0
- package/dist/core/nav.js +22 -0
- package/dist/{content.d.ts → fallbacks/content.d.ts} +3 -3
- package/dist/fallbacks/content.js +3 -0
- package/dist/{llms.d.ts → fallbacks/llms.d.ts} +2 -3
- package/dist/fallbacks/llms.js +3 -0
- package/dist/fallbacks/missing-plugin.d.ts +7 -0
- package/dist/fallbacks/missing-plugin.js +11 -0
- package/dist/{search.d.ts → fallbacks/search.d.ts} +3 -3
- package/dist/fallbacks/search.js +3 -0
- package/dist/{generate-llms.d.ts → generate/llms.d.ts} +1 -1
- package/dist/index.d.ts +23 -23
- package/dist/index.js +24 -24
- package/dist/search/create-search.d.ts +1 -1
- package/dist/theme.css +57 -57
- package/dist/themes/darkmatter.css +6 -4
- package/dist/themes/tangerine.css +3 -6
- package/package.json +21 -13
- package/dist/config.d.ts +0 -141
- package/dist/content.js +0 -4
- package/dist/llms.js +0 -4
- package/dist/search.js +0 -4
- package/dist/vite.js +0 -366
- /package/dist/{highlight.d.ts → buildtime/highlight.d.ts} +0 -0
- /package/dist/{highlight.js → buildtime/highlight.js} +0 -0
- /package/dist/{preprocess.d.ts → buildtime/preprocess.d.ts} +0 -0
- /package/dist/{preprocess.js → buildtime/preprocess.js} +0 -0
- /package/dist/{ui → components/chrome}/background-pattern.svelte +0 -0
- /package/dist/{ui → components/chrome}/background-pattern.svelte.d.ts +0 -0
- /package/dist/{ui → components/chrome}/copy-button.svelte.d.ts +0 -0
- /package/dist/{ui → components/chrome}/search-trigger.svelte.d.ts +0 -0
- /package/dist/{ui → components/chrome}/theme-provider.svelte +0 -0
- /package/dist/{ui → components/chrome}/theme-provider.svelte.d.ts +0 -0
- /package/dist/{ui → components/chrome}/theme-toggle.svelte.d.ts +0 -0
- /package/dist/{ui → components/docs}/accordion-item.svelte.d.ts +0 -0
- /package/dist/{ui → components/docs}/accordion.svelte.d.ts +0 -0
- /package/dist/{ui → components/docs}/badge.svelte.d.ts +0 -0
- /package/dist/{ui → components/docs}/callout.svelte +0 -0
- /package/dist/{ui → components/docs}/callout.svelte.d.ts +0 -0
- /package/dist/{ui → components/docs}/card-grid.svelte +0 -0
- /package/dist/{ui → components/docs}/card-grid.svelte.d.ts +0 -0
- /package/dist/{ui → components/docs}/card.svelte +0 -0
- /package/dist/{ui → components/docs}/card.svelte.d.ts +0 -0
- /package/dist/{ui → components/docs}/file-tree-item.svelte +0 -0
- /package/dist/{ui → components/docs}/file-tree-item.svelte.d.ts +0 -0
- /package/dist/{ui → components/docs}/file-tree.svelte +0 -0
- /package/dist/{ui → components/docs}/file-tree.svelte.d.ts +0 -0
- /package/dist/{ui → components/docs}/kbd.svelte +0 -0
- /package/dist/{ui → components/docs}/kbd.svelte.d.ts +0 -0
- /package/dist/{ui → components/docs}/live-example.svelte.d.ts +0 -0
- /package/dist/{ui → components/docs}/prop.svelte +0 -0
- /package/dist/{ui → components/docs}/prop.svelte.d.ts +0 -0
- /package/dist/{ui → components/docs}/props-table.svelte +0 -0
- /package/dist/{ui → components/docs}/props-table.svelte.d.ts +0 -0
- /package/dist/{ui → components/docs}/step.svelte +0 -0
- /package/dist/{ui → components/docs}/step.svelte.d.ts +0 -0
- /package/dist/{ui → components/docs}/steps.svelte +0 -0
- /package/dist/{ui → components/docs}/steps.svelte.d.ts +0 -0
- /package/dist/{ui → components/docs}/tab-item.svelte.d.ts +0 -0
- /package/dist/{ui → components/docs}/tabs-phase.svelte +0 -0
- /package/dist/{ui → components/docs}/tabs-phase.svelte.d.ts +0 -0
- /package/dist/{ui → components/docs}/tabs.svelte.d.ts +0 -0
- /package/dist/{ui → components}/icons/github.svelte +0 -0
- /package/dist/{ui → components}/icons/github.svelte.d.ts +0 -0
- /package/dist/{ui → components}/layouts/breadcrumbs.svelte +0 -0
- /package/dist/{ui → components}/layouts/breadcrumbs.svelte.d.ts +0 -0
- /package/dist/{ui → components}/layouts/copy-page-menu.svelte +0 -0
- /package/dist/{ui → components}/layouts/copy-page-menu.svelte.d.ts +0 -0
- /package/dist/{ui → components}/markdown/code.svelte +0 -0
- /package/dist/{ui → components}/markdown/code.svelte.d.ts +0 -0
- /package/dist/{ui → components}/markdown/h2.svelte +0 -0
- /package/dist/{ui → components}/markdown/h2.svelte.d.ts +0 -0
- /package/dist/{ui → components}/markdown/h3.svelte +0 -0
- /package/dist/{ui → components}/markdown/h3.svelte.d.ts +0 -0
- /package/dist/{ui → components}/markdown/index.d.ts +0 -0
- /package/dist/{ui → components}/markdown/index.js +0 -0
- /package/dist/{ui → components}/markdown/pre.svelte.d.ts +0 -0
- /package/dist/{ui → components}/markdown/table.svelte +0 -0
- /package/dist/{ui → components}/markdown/table.svelte.d.ts +0 -0
- /package/dist/{types.js → components/markdown/types.js} +0 -0
- /package/dist/{ui → components}/shadcn/accordion/accordion-content.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/accordion/accordion-item.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/accordion/accordion.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/accordion/index.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/accordion/index.js +0 -0
- /package/dist/{ui → components}/shadcn/badge/index.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/badge/index.js +0 -0
- /package/dist/{ui → components}/shadcn/button/index.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/button/index.js +0 -0
- /package/dist/{ui → components}/shadcn/command/command-empty.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/command/command-group.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/command/command-input.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/command/command-item.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/command/command-link-item.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/command/command-list.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/command/command-loading.svelte +0 -0
- /package/dist/{ui → components}/shadcn/command/command-loading.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/command/command-separator.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/command/command.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/command/index.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/command/index.js +0 -0
- /package/dist/{ui → components}/shadcn/dialog/dialog-close.svelte +0 -0
- /package/dist/{ui → components}/shadcn/dialog/dialog-close.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/dialog/dialog-description.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/dialog/dialog-overlay.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/dialog/dialog-portal.svelte +0 -0
- /package/dist/{ui → components}/shadcn/dialog/dialog-portal.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/dialog/dialog-title.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/dialog/dialog-trigger.svelte +0 -0
- /package/dist/{ui → components}/shadcn/dialog/dialog-trigger.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/dialog/dialog.svelte +0 -0
- /package/dist/{ui → components}/shadcn/dialog/dialog.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/dialog/index.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/dialog/index.js +0 -0
- /package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-checkbox-group.svelte +0 -0
- /package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-checkbox-group.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-group-heading.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-group.svelte +0 -0
- /package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-group.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-item.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-portal.svelte +0 -0
- /package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-portal.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-radio-group.svelte +0 -0
- /package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-radio-group.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-radio-item.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-separator.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-sub-content.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-sub-trigger.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-sub.svelte +0 -0
- /package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-sub.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-trigger.svelte +0 -0
- /package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu-trigger.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu.svelte +0 -0
- /package/dist/{ui → components}/shadcn/dropdown-menu/dropdown-menu.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/dropdown-menu/index.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/dropdown-menu/index.js +0 -0
- /package/dist/{ui → components}/shadcn/input/index.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/input/index.js +0 -0
- /package/dist/{ui → components}/shadcn/input-group/index.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/input-group/index.js +0 -0
- /package/dist/{ui → components}/shadcn/input-group/input-group-button.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/popover/index.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/popover/index.js +0 -0
- /package/dist/{ui → components}/shadcn/popover/popover-close.svelte +0 -0
- /package/dist/{ui → components}/shadcn/popover/popover-close.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/popover/popover-portal.svelte +0 -0
- /package/dist/{ui → components}/shadcn/popover/popover-portal.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/popover/popover-trigger.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/popover/popover.svelte +0 -0
- /package/dist/{ui → components}/shadcn/popover/popover.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/scroll-area/index.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/scroll-area/index.js +0 -0
- /package/dist/{ui → components}/shadcn/scroll-area/scroll-area-scrollbar.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/separator/index.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/separator/index.js +0 -0
- /package/dist/{ui → components}/shadcn/separator/separator.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/sheet/index.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/sheet/index.js +0 -0
- /package/dist/{ui → components}/shadcn/sheet/sheet-close.svelte +0 -0
- /package/dist/{ui → components}/shadcn/sheet/sheet-close.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/sheet/sheet-description.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/sheet/sheet-overlay.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/sheet/sheet-portal.svelte +0 -0
- /package/dist/{ui → components}/shadcn/sheet/sheet-portal.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/sheet/sheet-title.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/sheet/sheet-trigger.svelte +0 -0
- /package/dist/{ui → components}/shadcn/sheet/sheet-trigger.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/sheet/sheet.svelte +0 -0
- /package/dist/{ui → components}/shadcn/sheet/sheet.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/tabs/index.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/tabs/index.js +0 -0
- /package/dist/{ui → components}/shadcn/tabs/tabs-content.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/tabs/tabs-list.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/tabs/tabs-trigger.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/tabs/tabs.svelte.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/textarea/index.d.ts +0 -0
- /package/dist/{ui → components}/shadcn/textarea/index.js +0 -0
- /package/dist/{generate-llms.js → generate/llms.js} +0 -0
- /package/dist/{sitemap.d.ts → generate/sitemap.d.ts} +0 -0
- /package/dist/{sitemap.js → generate/sitemap.js} +0 -0
- /package/dist/{clipboard.svelte.d.ts → utils/clipboard.svelte.d.ts} +0 -0
- /package/dist/{clipboard.svelte.js → utils/clipboard.svelte.js} +0 -0
- /package/dist/{shadcn.d.ts → utils/cn.d.ts} +0 -0
- /package/dist/{shadcn.js → utils/cn.js} +0 -0
- /package/dist/{normalize-path.d.ts → utils/normalize-path.d.ts} +0 -0
- /package/dist/{normalize-path.js → utils/normalize-path.js} +0 -0
- /package/dist/{types.d.ts → utils/types.d.ts} +0 -0
- /package/dist/{ui/markdown → utils}/types.js +0 -0
package/dist/config.d.ts
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Static site configuration passed to `DocsShell`. Content-derived data (the
|
|
3
|
-
* sidebar nav) is NOT here — it comes from your content collection at runtime.
|
|
4
|
-
*/
|
|
5
|
-
/** A link rendered in the header nav or footer. */
|
|
6
|
-
export type DocsmithLink = {
|
|
7
|
-
label: string;
|
|
8
|
-
href: string;
|
|
9
|
-
/** Open in a new tab with `rel="noopener"`. */
|
|
10
|
-
external?: boolean;
|
|
11
|
-
};
|
|
12
|
-
/** A titled column of links in the footer. */
|
|
13
|
-
export type DocsmithFooterColumn = {
|
|
14
|
-
title: string;
|
|
15
|
-
links: DocsmithLink[];
|
|
16
|
-
};
|
|
17
|
-
export type DocsmithConfig = {
|
|
18
|
-
/** Site title, shown in the header/sidebar and in the `<title>` suffix. */
|
|
19
|
-
title: string;
|
|
20
|
-
/**
|
|
21
|
-
* Default meta description, used for pages whose frontmatter has none (and
|
|
22
|
-
* as the site's social-share description).
|
|
23
|
-
*/
|
|
24
|
-
description?: string;
|
|
25
|
-
/**
|
|
26
|
-
* Canonical site origin, e.g. `https://docs.example.com`. When set, DocsShell
|
|
27
|
-
* emits `<link rel="canonical">` and absolute Open Graph URLs.
|
|
28
|
-
*/
|
|
29
|
-
url?: string;
|
|
30
|
-
/** Default social-share image (absolute URL, or a path resolved against `url`). */
|
|
31
|
-
ogImage?: string;
|
|
32
|
-
/**
|
|
33
|
-
* Base URL for the "Edit this page" link, pointing at the directory that maps
|
|
34
|
-
* to your app's working directory in the repo, e.g.
|
|
35
|
-
* `https://github.com/you/repo/edit/main/apps/docs`. DocsShell appends each
|
|
36
|
-
* page's source path. Omit to hide the edit link.
|
|
37
|
-
*/
|
|
38
|
-
editUrl?: string;
|
|
39
|
-
/** Optional GitHub URL; renders a link in the header when set. */
|
|
40
|
-
github?: string;
|
|
41
|
-
/** Optional version string, shown in the header (e.g. your library version). */
|
|
42
|
-
version?: string;
|
|
43
|
-
/** Optional logo image src; falls back to the built-in book mark. */
|
|
44
|
-
logo?: string;
|
|
45
|
-
/** Top-level header navigation links. */
|
|
46
|
-
nav?: DocsmithLink[];
|
|
47
|
-
/** Footer content, driven by data. */
|
|
48
|
-
footer?: {
|
|
49
|
-
/** Copyright / attribution line. */
|
|
50
|
-
copyright?: string;
|
|
51
|
-
/** Titled columns of links. */
|
|
52
|
-
columns?: DocsmithFooterColumn[];
|
|
53
|
-
/**
|
|
54
|
-
* Show the "Powered by Svelte DocSmith" attribution in the footer.
|
|
55
|
-
* Defaults to `true`; set `false` to hide it.
|
|
56
|
-
*/
|
|
57
|
-
poweredBy?: boolean;
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
/**
|
|
61
|
-
* Validate a {@link DocsmithConfig} at build time. Purely a pass-through for
|
|
62
|
-
* typed callers; the runtime checks catch untyped or dynamically-built configs
|
|
63
|
-
* with a real error message instead of a blank header.
|
|
64
|
-
*/
|
|
65
|
-
export declare function defineConfig(config: DocsmithConfig): DocsmithConfig;
|
|
66
|
-
/**
|
|
67
|
-
* The minimal shape `DocsShell` needs from each content entry to build the
|
|
68
|
-
* sidebar. The generated `svelte-docsmith/content` module produces these from
|
|
69
|
-
* your pages' frontmatter; any source with matching title/path/section/order
|
|
70
|
-
* fields satisfies it structurally.
|
|
71
|
-
*/
|
|
72
|
-
export type DocsContentItem = {
|
|
73
|
-
title: string;
|
|
74
|
-
path: string;
|
|
75
|
-
section?: string;
|
|
76
|
-
order?: number;
|
|
77
|
-
description?: string;
|
|
78
|
-
/** Source file path relative to the app cwd, for the "Edit this page" link. */
|
|
79
|
-
sourcePath?: string;
|
|
80
|
-
/** Last git commit date (ISO) for the page's source file. */
|
|
81
|
-
lastUpdated?: string;
|
|
82
|
-
/**
|
|
83
|
-
* The page's `h2`/`h3` headings, extracted at build time by the `docsmith()`
|
|
84
|
-
* vite plugin, so `DocsShell` can render the in-page TOC server-side. The
|
|
85
|
-
* runtime TOC engine still owns scroll-spy and re-scans the DOM.
|
|
86
|
-
*/
|
|
87
|
-
toc?: {
|
|
88
|
-
id: string;
|
|
89
|
-
title: string;
|
|
90
|
-
depth: 2 | 3;
|
|
91
|
-
}[];
|
|
92
|
-
};
|
|
93
|
-
/**
|
|
94
|
-
* One page's searchable record, emitted at build time by the `docsmith()` vite
|
|
95
|
-
* plugin as the `svelte-docsmith/search` virtual module. `text` is the page's
|
|
96
|
-
* prose and headings reduced to plain text (frontmatter, `<script>` blocks,
|
|
97
|
-
* fenced code, tags, and markdown punctuation stripped) so a client-side search
|
|
98
|
-
* index can be built over it without shipping raw markdown.
|
|
99
|
-
*/
|
|
100
|
-
export type SearchDoc = {
|
|
101
|
-
path: string;
|
|
102
|
-
title: string;
|
|
103
|
-
section?: string;
|
|
104
|
-
description?: string;
|
|
105
|
-
/** The page's `h2`/`h3` heading text, for weighting title/heading matches. */
|
|
106
|
-
headings: string[];
|
|
107
|
-
/** Plain-text body: prose and headings, code and markup removed. */
|
|
108
|
-
text: string;
|
|
109
|
-
};
|
|
110
|
-
/**
|
|
111
|
-
* One page's record for LLM-facing output, emitted at build time by the
|
|
112
|
-
* `docsmith()` vite plugin as the `svelte-docsmith/llms` virtual module. Feeds
|
|
113
|
-
* `generateLlmsTxt` (an index) and `generateLlmsFullTxt` (the full corpus).
|
|
114
|
-
*/
|
|
115
|
-
export type LlmsDoc = {
|
|
116
|
-
path: string;
|
|
117
|
-
title: string;
|
|
118
|
-
section?: string;
|
|
119
|
-
/** Sidebar order within the section, so LLM output follows reading order. */
|
|
120
|
-
order?: number;
|
|
121
|
-
description?: string;
|
|
122
|
-
/** The page's markdown body (frontmatter and `<script>`/`<style>` removed,
|
|
123
|
-
* headings and code kept), with the title prepended as an `h1`. */
|
|
124
|
-
content: string;
|
|
125
|
-
};
|
|
126
|
-
/** A single sidebar link. */
|
|
127
|
-
export type NavItem = {
|
|
128
|
-
title: string;
|
|
129
|
-
url: string;
|
|
130
|
-
};
|
|
131
|
-
/** A titled group of sidebar links. */
|
|
132
|
-
export type NavGroup = {
|
|
133
|
-
title: string;
|
|
134
|
-
items: NavItem[];
|
|
135
|
-
};
|
|
136
|
-
/**
|
|
137
|
-
* Derive sidebar nav from a content collection: group by `section`, order by
|
|
138
|
-
* `order` within a group, and order groups by the smallest `order` they
|
|
139
|
-
* contain. Entries without a `section` fall under "Docs".
|
|
140
|
-
*/
|
|
141
|
-
export declare function navFromContent(content: DocsContentItem[]): NavGroup[];
|
package/dist/content.js
DELETED
package/dist/llms.js
DELETED
package/dist/search.js
DELETED
package/dist/vite.js
DELETED
|
@@ -1,366 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `svelte-docsmith/vite` — the build-time half of the framework. Node context
|
|
3
|
-
* only. One `docsmith()` call in `vite.config.ts` wires three things:
|
|
4
|
-
*
|
|
5
|
-
* 1. A **content index** served as the virtual module `svelte-docsmith/content`
|
|
6
|
-
* — your doc pages' frontmatter, scanned at build time, so the sidebar nav
|
|
7
|
-
* is derived from content and never hand-written. No collection config, no
|
|
8
|
-
* aliases.
|
|
9
|
-
* 2. A **search index** served as the virtual module `svelte-docsmith/search`
|
|
10
|
-
* — the same pages reduced to plain-text bodies, in a separate chunk so it
|
|
11
|
-
* can be lazy-loaded only when search opens.
|
|
12
|
-
* 3. The **`?source` transform** powering `LiveExample`: importing
|
|
13
|
-
* `Component.svelte?source` yields that file's Shiki-highlighted source.
|
|
14
|
-
*/
|
|
15
|
-
import { spawnSync } from 'node:child_process';
|
|
16
|
-
import fs from 'node:fs';
|
|
17
|
-
import path from 'node:path';
|
|
18
|
-
import GithubSlugger from 'github-slugger';
|
|
19
|
-
import yaml from 'js-yaml';
|
|
20
|
-
import { DEFAULT_THEMES, lazyHighlighter } from './highlight.js';
|
|
21
|
-
/**
|
|
22
|
-
* The svelte-docsmith Vite plugin. Add it to `plugins` in `vite.config.ts`:
|
|
23
|
-
*
|
|
24
|
-
* ```ts
|
|
25
|
-
* import { docsmith } from 'svelte-docsmith/vite';
|
|
26
|
-
* export default defineConfig({ plugins: [docsmith(), tailwindcss(), sveltekit()] });
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
export function docsmith(options = {}) {
|
|
30
|
-
return [contentIndexPlugin(options), exampleSourcePlugin(options)];
|
|
31
|
-
}
|
|
32
|
-
// --- content index -------------------------------------------------------
|
|
33
|
-
const CONTENT_SPECIFIER = 'svelte-docsmith/content';
|
|
34
|
-
const VIRTUAL_CONTENT_ID = '\0svelte-docsmith:content';
|
|
35
|
-
const SEARCH_SPECIFIER = 'svelte-docsmith/search';
|
|
36
|
-
const VIRTUAL_SEARCH_ID = '\0svelte-docsmith:search';
|
|
37
|
-
const LLMS_SPECIFIER = 'svelte-docsmith/llms';
|
|
38
|
-
const VIRTUAL_LLMS_ID = '\0svelte-docsmith:llms';
|
|
39
|
-
const PAGE_NAMES = ['+page.md', '+page.svx'];
|
|
40
|
-
function isPageFile(file) {
|
|
41
|
-
return PAGE_NAMES.some((name) => file.endsWith(name));
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* List the absolute paths of every `+page.md`/`+page.svx` under `contentDir`.
|
|
45
|
-
*/
|
|
46
|
-
function listPageFiles(contentDir) {
|
|
47
|
-
if (!fs.existsSync(contentDir))
|
|
48
|
-
return [];
|
|
49
|
-
const entries = fs.readdirSync(contentDir, { recursive: true, withFileTypes: true });
|
|
50
|
-
const files = [];
|
|
51
|
-
for (const entry of entries) {
|
|
52
|
-
if (!entry.isFile() || !isPageFile(entry.name))
|
|
53
|
-
continue;
|
|
54
|
-
const dir = entry.parentPath ?? entry.path ?? contentDir;
|
|
55
|
-
files.push(path.join(dir, entry.name));
|
|
56
|
-
}
|
|
57
|
-
return files;
|
|
58
|
-
}
|
|
59
|
-
/** Strip inline markdown so a heading's TOC label is plain text. */
|
|
60
|
-
function stripInlineMarkdown(text) {
|
|
61
|
-
return text
|
|
62
|
-
.replace(/!\[([^\]]*)\]\([^)]*\)/g, '$1')
|
|
63
|
-
.replace(/`([^`]+)`/g, '$1')
|
|
64
|
-
.replace(/\*\*([^*]+)\*\*/g, '$1')
|
|
65
|
-
.replace(/\*([^*]+)\*/g, '$1')
|
|
66
|
-
.replace(/\[([^\]]+)\]\([^)]*\)/g, '$1')
|
|
67
|
-
.replace(/[_~]/g, '')
|
|
68
|
-
.trim();
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Reduce a markdown page to plain, searchable body text: prose and heading text
|
|
72
|
-
* with frontmatter, `<script>`/`<style>` blocks, fenced code, HTML/Svelte tags,
|
|
73
|
-
* and markdown punctuation removed. Feeds the generated search index. Code
|
|
74
|
-
* samples are intentionally dropped to keep the index small and prose-focused.
|
|
75
|
-
*/
|
|
76
|
-
function extractSearchText(source) {
|
|
77
|
-
let body = source.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/, '');
|
|
78
|
-
// Component/setup blocks aren't prose; drop them whole before line scanning.
|
|
79
|
-
body = body.replace(/<script[\s\S]*?<\/script>/gi, '').replace(/<style[\s\S]*?<\/style>/gi, '');
|
|
80
|
-
const out = [];
|
|
81
|
-
let fence = null;
|
|
82
|
-
for (const line of body.split('\n')) {
|
|
83
|
-
const f = /^\s*(`{3,}|~{3,})/.exec(line);
|
|
84
|
-
if (f) {
|
|
85
|
-
const ch = f[1][0];
|
|
86
|
-
if (fence === null)
|
|
87
|
-
fence = ch;
|
|
88
|
-
else if (ch === fence)
|
|
89
|
-
fence = null;
|
|
90
|
-
continue;
|
|
91
|
-
}
|
|
92
|
-
if (fence !== null)
|
|
93
|
-
continue;
|
|
94
|
-
// Skip table delimiter rows (`| --- | :--: |`) — pure structure, no words.
|
|
95
|
-
if (/^\s*\|?[\s:|-]+\|[\s:|-]*$/.test(line))
|
|
96
|
-
continue;
|
|
97
|
-
const text = stripInlineMarkdown(line
|
|
98
|
-
.replace(/<[^>]+>/g, ' ') // strip HTML/Svelte tags, keep their text content
|
|
99
|
-
.replace(/^\s{0,3}#{1,6}\s+/, '') // heading markers
|
|
100
|
-
.replace(/^\s{0,3}>\s?/, '') // blockquote markers
|
|
101
|
-
.replace(/^\s*[-*+]\s+/, '') // unordered list bullets
|
|
102
|
-
.replace(/^\s*\d+\.\s+/, '') // ordered list markers
|
|
103
|
-
.replace(/\s*\|\s*/g, ' ') // table cell separators → spaces, not "| a | b |"
|
|
104
|
-
).replace(/\s+/g, ' ');
|
|
105
|
-
if (text)
|
|
106
|
-
out.push(text);
|
|
107
|
-
}
|
|
108
|
-
return out.join(' ');
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Extract `h2`/`h3` headings from a markdown page so the in-page TOC can be
|
|
112
|
-
* server-rendered (no post-hydration pop-in). Skips fenced code blocks. Ids are
|
|
113
|
-
* produced with the same `github-slugger` that `rehype-slug` uses at render
|
|
114
|
-
* time — including its duplicate-suffixing — so the SSR anchors match the real
|
|
115
|
-
* heading ids exactly, not just for common cases.
|
|
116
|
-
*/
|
|
117
|
-
function extractToc(source) {
|
|
118
|
-
const body = source.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/, '');
|
|
119
|
-
const slugger = new GithubSlugger();
|
|
120
|
-
const toc = [];
|
|
121
|
-
let fence = null;
|
|
122
|
-
for (const line of body.split('\n')) {
|
|
123
|
-
const f = /^\s*(`{3,}|~{3,})/.exec(line);
|
|
124
|
-
if (f) {
|
|
125
|
-
const ch = f[1][0];
|
|
126
|
-
if (fence === null)
|
|
127
|
-
fence = ch;
|
|
128
|
-
else if (ch === fence)
|
|
129
|
-
fence = null;
|
|
130
|
-
continue;
|
|
131
|
-
}
|
|
132
|
-
if (fence !== null)
|
|
133
|
-
continue;
|
|
134
|
-
const m = /^(#{2,3})\s+(.+?)\s*#*\s*$/.exec(line);
|
|
135
|
-
if (!m)
|
|
136
|
-
continue;
|
|
137
|
-
const title = stripInlineMarkdown(m[2]);
|
|
138
|
-
if (!title)
|
|
139
|
-
continue;
|
|
140
|
-
toc.push({ id: slugger.slug(title), title, depth: m[1].length });
|
|
141
|
-
}
|
|
142
|
-
return toc;
|
|
143
|
-
}
|
|
144
|
-
/** Last git commit date (strict ISO) for a file, or undefined outside a repo. */
|
|
145
|
-
function lastCommitDate(file) {
|
|
146
|
-
const res = spawnSync('git', ['log', '-1', '--format=%cI', '--', file], {
|
|
147
|
-
cwd: path.dirname(file),
|
|
148
|
-
encoding: 'utf-8'
|
|
149
|
-
});
|
|
150
|
-
const date = res.status === 0 ? res.stdout.trim() : '';
|
|
151
|
-
return date || undefined;
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Walk every nav-worthy page under `contentDir` once: a page is nav-worthy when
|
|
155
|
-
* its frontmatter has a string `title`. Yields the raw source, parsed
|
|
156
|
-
* frontmatter, derived URL, and title so both the nav index and the search
|
|
157
|
-
* index can be built from a single read of each file.
|
|
158
|
-
*/
|
|
159
|
-
function* eachTitledPage(contentDir, routesDir) {
|
|
160
|
-
for (const file of listPageFiles(contentDir)) {
|
|
161
|
-
const source = fs.readFileSync(file, 'utf-8');
|
|
162
|
-
const front = parseFrontmatter(source, file);
|
|
163
|
-
if (typeof front.title !== 'string')
|
|
164
|
-
continue;
|
|
165
|
-
const dir = path.dirname(file);
|
|
166
|
-
const url = '/' + path.relative(routesDir, dir).split(path.sep).join('/');
|
|
167
|
-
yield { source, front, url, title: front.title, file };
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
export function collectDocs(contentDir, routesDir) {
|
|
171
|
-
if (!fs.existsSync(contentDir)) {
|
|
172
|
-
console.warn(`[svelte-docsmith] content directory not found: ${contentDir}\n` +
|
|
173
|
-
` The sidebar will be empty. Create your doc pages there, or point docsmith() at the right place with \`content\`.`);
|
|
174
|
-
return [];
|
|
175
|
-
}
|
|
176
|
-
const items = [];
|
|
177
|
-
for (const { source, front, url, title, file } of eachTitledPage(contentDir, routesDir)) {
|
|
178
|
-
items.push({
|
|
179
|
-
title,
|
|
180
|
-
path: url,
|
|
181
|
-
description: typeof front.description === 'string' ? front.description : undefined,
|
|
182
|
-
section: typeof front.section === 'string' ? front.section : undefined,
|
|
183
|
-
order: typeof front.order === 'number' ? front.order : undefined,
|
|
184
|
-
sourcePath: path.relative(process.cwd(), file).split(path.sep).join('/'),
|
|
185
|
-
lastUpdated: lastCommitDate(file),
|
|
186
|
-
toc: extractToc(source)
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
if (items.length === 0) {
|
|
190
|
-
console.warn(`[svelte-docsmith] no doc pages found under ${contentDir}\n` +
|
|
191
|
-
` Add \`+page.md\` files with at least a \`title:\` in their frontmatter to populate the sidebar.`);
|
|
192
|
-
}
|
|
193
|
-
// Stable output keeps the generated module diff-friendly across rebuilds.
|
|
194
|
-
return items.sort((a, b) => a.path.localeCompare(b.path));
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Build the search records for every page under `contentDir`: title, section,
|
|
198
|
-
* description, heading list, and plain-text body. Served as the lazy-loaded
|
|
199
|
-
* `svelte-docsmith/search` virtual module so search can index bodies without
|
|
200
|
-
* bloating the eagerly-imported nav index. The missing-directory case is
|
|
201
|
-
* already reported by {@link collectDocs}, so this stays quiet.
|
|
202
|
-
*/
|
|
203
|
-
export function collectSearchDocs(contentDir, routesDir) {
|
|
204
|
-
if (!fs.existsSync(contentDir))
|
|
205
|
-
return [];
|
|
206
|
-
const docs = [];
|
|
207
|
-
for (const { source, front, url, title } of eachTitledPage(contentDir, routesDir)) {
|
|
208
|
-
docs.push({
|
|
209
|
-
path: url,
|
|
210
|
-
title,
|
|
211
|
-
section: typeof front.section === 'string' ? front.section : undefined,
|
|
212
|
-
description: typeof front.description === 'string' ? front.description : undefined,
|
|
213
|
-
headings: extractToc(source).map((entry) => entry.title),
|
|
214
|
-
text: extractSearchText(source)
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
return docs.sort((a, b) => a.path.localeCompare(b.path));
|
|
218
|
-
}
|
|
219
|
-
/**
|
|
220
|
-
* The page's markdown body for LLM output: frontmatter and `<script>`/`<style>`
|
|
221
|
-
* blocks removed, everything else (headings, prose, code, component tags) kept,
|
|
222
|
-
* with the frontmatter title prepended as an `h1` (pages start their body at h2).
|
|
223
|
-
*/
|
|
224
|
-
function extractLlmsContent(source, title) {
|
|
225
|
-
const body = source
|
|
226
|
-
.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/, '')
|
|
227
|
-
.replace(/<script[\s\S]*?<\/script>/gi, '')
|
|
228
|
-
.replace(/<style[\s\S]*?<\/style>/gi, '')
|
|
229
|
-
.trim();
|
|
230
|
-
return `# ${title}\n\n${body}`;
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* Build the LLM records for every page: title, section, description, and the
|
|
234
|
-
* full markdown content. Served as the `svelte-docsmith/llms` virtual module and
|
|
235
|
-
* consumed server-side by `llms.txt` / `llms-full.txt` routes, so it never ships
|
|
236
|
-
* to the client.
|
|
237
|
-
*/
|
|
238
|
-
export function collectLlmsDocs(contentDir, routesDir) {
|
|
239
|
-
if (!fs.existsSync(contentDir))
|
|
240
|
-
return [];
|
|
241
|
-
const docs = [];
|
|
242
|
-
for (const { source, front, url, title } of eachTitledPage(contentDir, routesDir)) {
|
|
243
|
-
docs.push({
|
|
244
|
-
path: url,
|
|
245
|
-
title,
|
|
246
|
-
section: typeof front.section === 'string' ? front.section : undefined,
|
|
247
|
-
order: typeof front.order === 'number' ? front.order : undefined,
|
|
248
|
-
description: typeof front.description === 'string' ? front.description : undefined,
|
|
249
|
-
content: extractLlmsContent(source, title)
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
return docs.sort((a, b) => a.path.localeCompare(b.path));
|
|
253
|
-
}
|
|
254
|
-
function parseFrontmatter(source, file) {
|
|
255
|
-
const match = /^---\r?\n([\s\S]*?)\r?\n---/.exec(source);
|
|
256
|
-
if (!match)
|
|
257
|
-
return {};
|
|
258
|
-
let data;
|
|
259
|
-
try {
|
|
260
|
-
data = yaml.load(match[1]);
|
|
261
|
-
}
|
|
262
|
-
catch (err) {
|
|
263
|
-
const reason = err instanceof Error ? err.message : String(err);
|
|
264
|
-
throw new Error(`[svelte-docsmith] invalid YAML frontmatter in ${file}\n${reason}`);
|
|
265
|
-
}
|
|
266
|
-
return data && typeof data === 'object' ? data : {};
|
|
267
|
-
}
|
|
268
|
-
function contentIndexPlugin(options) {
|
|
269
|
-
const contentDir = path.resolve(options.content ?? 'src/routes/docs');
|
|
270
|
-
const routesDir = path.resolve(options.routes ?? 'src/routes');
|
|
271
|
-
return {
|
|
272
|
-
name: 'docsmith-content',
|
|
273
|
-
enforce: 'pre',
|
|
274
|
-
resolveId(id) {
|
|
275
|
-
if (id === CONTENT_SPECIFIER)
|
|
276
|
-
return VIRTUAL_CONTENT_ID;
|
|
277
|
-
if (id === SEARCH_SPECIFIER)
|
|
278
|
-
return VIRTUAL_SEARCH_ID;
|
|
279
|
-
if (id === LLMS_SPECIFIER)
|
|
280
|
-
return VIRTUAL_LLMS_ID;
|
|
281
|
-
},
|
|
282
|
-
load(id) {
|
|
283
|
-
// Watch each page file (not the directory) so editing frontmatter or
|
|
284
|
-
// body re-runs this load. A directory here is treated as an
|
|
285
|
-
// unresolvable import by vite:import-analysis; new/removed pages are
|
|
286
|
-
// handled by the watcher in configureServer.
|
|
287
|
-
if (id === VIRTUAL_CONTENT_ID) {
|
|
288
|
-
for (const file of listPageFiles(contentDir))
|
|
289
|
-
this.addWatchFile(file);
|
|
290
|
-
const docs = collectDocs(contentDir, routesDir);
|
|
291
|
-
return `export const docs = ${JSON.stringify(docs, null, 2)};\n`;
|
|
292
|
-
}
|
|
293
|
-
if (id === VIRTUAL_SEARCH_ID) {
|
|
294
|
-
for (const file of listPageFiles(contentDir))
|
|
295
|
-
this.addWatchFile(file);
|
|
296
|
-
const docs = collectSearchDocs(contentDir, routesDir);
|
|
297
|
-
return `export const docs = ${JSON.stringify(docs)};\n`;
|
|
298
|
-
}
|
|
299
|
-
if (id === VIRTUAL_LLMS_ID) {
|
|
300
|
-
for (const file of listPageFiles(contentDir))
|
|
301
|
-
this.addWatchFile(file);
|
|
302
|
-
const docs = collectLlmsDocs(contentDir, routesDir);
|
|
303
|
-
return `export const docs = ${JSON.stringify(docs)};\n`;
|
|
304
|
-
}
|
|
305
|
-
},
|
|
306
|
-
configureServer(server) {
|
|
307
|
-
server.watcher.add(contentDir);
|
|
308
|
-
const onChange = (file) => {
|
|
309
|
-
if (!isPageFile(file))
|
|
310
|
-
return;
|
|
311
|
-
let invalidated = false;
|
|
312
|
-
for (const virtualId of [VIRTUAL_CONTENT_ID, VIRTUAL_SEARCH_ID, VIRTUAL_LLMS_ID]) {
|
|
313
|
-
const mod = server.moduleGraph.getModuleById(virtualId);
|
|
314
|
-
if (!mod)
|
|
315
|
-
continue;
|
|
316
|
-
server.moduleGraph.invalidateModule(mod);
|
|
317
|
-
invalidated = true;
|
|
318
|
-
}
|
|
319
|
-
if (invalidated)
|
|
320
|
-
server.ws.send({ type: 'full-reload' });
|
|
321
|
-
};
|
|
322
|
-
server.watcher.on('add', onChange);
|
|
323
|
-
server.watcher.on('unlink', onChange);
|
|
324
|
-
server.watcher.on('change', onChange);
|
|
325
|
-
}
|
|
326
|
-
};
|
|
327
|
-
}
|
|
328
|
-
// --- ?source transform (LiveExample) ------------------------------------
|
|
329
|
-
const SOURCE_PREFIX = '\0docsmith-source:';
|
|
330
|
-
// The virtual id must NOT end in `.svelte`, or vite-plugin-svelte will try to
|
|
331
|
-
// compile the highlighted-HTML string as a component.
|
|
332
|
-
const SOURCE_EXT = '.docsmith-src';
|
|
333
|
-
const SOURCE_SUFFIX = '?source';
|
|
334
|
-
function exampleSourcePlugin(options) {
|
|
335
|
-
const themes = options.themes ?? DEFAULT_THEMES;
|
|
336
|
-
const getHighlighter = lazyHighlighter([themes.light, themes.dark], ['svelte']);
|
|
337
|
-
return {
|
|
338
|
-
name: 'docsmith-example-source',
|
|
339
|
-
enforce: 'pre',
|
|
340
|
-
async resolveId(id, importer) {
|
|
341
|
-
if (!id.endsWith('.svelte' + SOURCE_SUFFIX))
|
|
342
|
-
return;
|
|
343
|
-
const base = id.slice(0, -SOURCE_SUFFIX.length);
|
|
344
|
-
const resolved = await this.resolve(base, importer, { skipSelf: true });
|
|
345
|
-
if (resolved)
|
|
346
|
-
return SOURCE_PREFIX + resolved.id + SOURCE_EXT;
|
|
347
|
-
},
|
|
348
|
-
async load(id) {
|
|
349
|
-
if (!id.startsWith(SOURCE_PREFIX))
|
|
350
|
-
return;
|
|
351
|
-
const file = id.slice(SOURCE_PREFIX.length, -SOURCE_EXT.length);
|
|
352
|
-
this.addWatchFile(file);
|
|
353
|
-
const code = fs.readFileSync(file, 'utf-8').trimEnd();
|
|
354
|
-
const highlighter = await getHighlighter();
|
|
355
|
-
// Strip Shiki's own surface (the inline light `background-color` and the
|
|
356
|
-
// `--shiki-dark-bg` var) so the highlighted source sits on the
|
|
357
|
-
// consuming component's token background — matching markdown code blocks,
|
|
358
|
-
// and never flashing Shiki's default before component CSS applies.
|
|
359
|
-
const html = highlighter
|
|
360
|
-
.codeToHtml(code, { lang: 'svelte', themes })
|
|
361
|
-
.replace(/background-color:[^;"]*;?/gi, '')
|
|
362
|
-
.replace(/--shiki-dark-bg:[^;"]*;?/gi, '');
|
|
363
|
-
return `export default ${JSON.stringify(html)};`;
|
|
364
|
-
}
|
|
365
|
-
};
|
|
366
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|