svelte-docsmith 0.5.1 → 0.6.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/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/package.json +11 -11
- 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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// mdsvex maps markdown elements to this module's exports (the export names
|
|
3
3
|
// must match the tag names). `docsmith()` injects this file as the default
|
|
4
4
|
// layout for every compiled markdown page.
|
|
5
|
-
import * as markdown from '
|
|
5
|
+
import * as markdown from '../components/markdown/index.js';
|
|
6
6
|
export const pre = markdown.pre;
|
|
7
7
|
export const code = markdown.code;
|
|
8
8
|
export const h2 = markdown.h2;
|
|
@@ -4,8 +4,8 @@ export declare const pre: import("svelte").Component<{
|
|
|
4
4
|
export declare const code: import("svelte").Component<{
|
|
5
5
|
children: Snippet;
|
|
6
6
|
}, {}, "">;
|
|
7
|
-
export declare const h2: import("svelte").Component<import("
|
|
8
|
-
export declare const h3: import("svelte").Component<import("
|
|
7
|
+
export declare const h2: import("svelte").Component<import("../components/markdown/types.js").HeadingProps, {}, "">;
|
|
8
|
+
export declare const h3: import("svelte").Component<import("../components/markdown/types.js").HeadingProps, {}, "">;
|
|
9
9
|
export declare const table: import("svelte").Component<{
|
|
10
10
|
children: Snippet;
|
|
11
11
|
}, {}, "">;
|
|
@@ -1,28 +1,10 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { DocsContentItem, LlmsDoc, SearchDoc } from './config.js';
|
|
3
|
-
export interface DocsmithViteOptions {
|
|
4
|
-
/** Directory scanned for doc pages. Default: `'src/routes/docs'`. */
|
|
5
|
-
content?: string;
|
|
6
|
-
/**
|
|
7
|
-
* Routes root used to derive each page's URL from its location.
|
|
8
|
-
* Default: `'src/routes'` (so `src/routes/docs/intro/+page.md` → `/docs/intro`).
|
|
9
|
-
*/
|
|
10
|
-
routes?: string;
|
|
11
|
-
/** Shiki themes for the `?source` render. Default: github-light/github-dark. */
|
|
12
|
-
themes?: {
|
|
13
|
-
light: string;
|
|
14
|
-
dark: string;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
1
|
+
import type { DocsContentItem, LlmsDoc, SearchDoc } from '../../core/content.js';
|
|
17
2
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* export default defineConfig({ plugins: [docsmith(), tailwindcss(), sveltekit()] });
|
|
23
|
-
* ```
|
|
3
|
+
* Scan `contentDir` for `+page.md`/`+page.svx` files and read the frontmatter
|
|
4
|
+
* fields the sidebar needs (plus the heading list for a server-rendered TOC and
|
|
5
|
+
* an estimated reading time), deriving each page's URL from its directory
|
|
6
|
+
* relative to `routesDir`. Pure and synchronous so it can be unit-tested.
|
|
24
7
|
*/
|
|
25
|
-
export declare function docsmith(options?: DocsmithViteOptions): Plugin[];
|
|
26
8
|
export declare function collectDocs(contentDir: string, routesDir: string): DocsContentItem[];
|
|
27
9
|
/**
|
|
28
10
|
* Build the search records for every page under `contentDir`: title, section,
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { listPageFiles } from './pages.js';
|
|
4
|
+
import { parseFrontmatter } from './frontmatter.js';
|
|
5
|
+
import { extractLlmsContent, extractSearchText, extractToc, readingMinutes } from './extract.js';
|
|
6
|
+
import { lastCommitDate } from './git.js';
|
|
7
|
+
/**
|
|
8
|
+
* Walk every nav-worthy page under `contentDir` once: a page is nav-worthy when
|
|
9
|
+
* its frontmatter has a string `title`. Yields the raw source, parsed
|
|
10
|
+
* frontmatter, derived URL, and title so every index (nav, search, llms) can be
|
|
11
|
+
* built from a single read of each file.
|
|
12
|
+
*/
|
|
13
|
+
function* eachTitledPage(contentDir, routesDir) {
|
|
14
|
+
for (const file of listPageFiles(contentDir)) {
|
|
15
|
+
const source = fs.readFileSync(file, 'utf-8');
|
|
16
|
+
const front = parseFrontmatter(source, file);
|
|
17
|
+
if (typeof front.title !== 'string')
|
|
18
|
+
continue;
|
|
19
|
+
const dir = path.dirname(file);
|
|
20
|
+
const url = '/' + path.relative(routesDir, dir).split(path.sep).join('/');
|
|
21
|
+
yield { source, front, url, title: front.title, file };
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Scan `contentDir` for `+page.md`/`+page.svx` files and read the frontmatter
|
|
26
|
+
* fields the sidebar needs (plus the heading list for a server-rendered TOC and
|
|
27
|
+
* an estimated reading time), deriving each page's URL from its directory
|
|
28
|
+
* relative to `routesDir`. Pure and synchronous so it can be unit-tested.
|
|
29
|
+
*/
|
|
30
|
+
export function collectDocs(contentDir, routesDir) {
|
|
31
|
+
if (!fs.existsSync(contentDir)) {
|
|
32
|
+
console.warn(`[svelte-docsmith] content directory not found: ${contentDir}\n` +
|
|
33
|
+
` The sidebar will be empty. Create your doc pages there, or point docsmith() at the right place with \`content\`.`);
|
|
34
|
+
return [];
|
|
35
|
+
}
|
|
36
|
+
const items = [];
|
|
37
|
+
for (const { source, front, url, title, file } of eachTitledPage(contentDir, routesDir)) {
|
|
38
|
+
items.push({
|
|
39
|
+
title,
|
|
40
|
+
path: url,
|
|
41
|
+
description: typeof front.description === 'string' ? front.description : undefined,
|
|
42
|
+
section: typeof front.section === 'string' ? front.section : undefined,
|
|
43
|
+
order: typeof front.order === 'number' ? front.order : undefined,
|
|
44
|
+
sourcePath: path.relative(process.cwd(), file).split(path.sep).join('/'),
|
|
45
|
+
lastUpdated: lastCommitDate(file),
|
|
46
|
+
readingTime: readingMinutes(extractSearchText(source)),
|
|
47
|
+
toc: extractToc(source)
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
if (items.length === 0) {
|
|
51
|
+
console.warn(`[svelte-docsmith] no doc pages found under ${contentDir}\n` +
|
|
52
|
+
` Add \`+page.md\` files with at least a \`title:\` in their frontmatter to populate the sidebar.`);
|
|
53
|
+
}
|
|
54
|
+
// Stable output keeps the generated module diff-friendly across rebuilds.
|
|
55
|
+
return items.sort((a, b) => a.path.localeCompare(b.path));
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Build the search records for every page under `contentDir`: title, section,
|
|
59
|
+
* description, heading list, and plain-text body. Served as the lazy-loaded
|
|
60
|
+
* `svelte-docsmith/search` virtual module so search can index bodies without
|
|
61
|
+
* bloating the eagerly-imported nav index. The missing-directory case is
|
|
62
|
+
* already reported by {@link collectDocs}, so this stays quiet.
|
|
63
|
+
*/
|
|
64
|
+
export function collectSearchDocs(contentDir, routesDir) {
|
|
65
|
+
if (!fs.existsSync(contentDir))
|
|
66
|
+
return [];
|
|
67
|
+
const docs = [];
|
|
68
|
+
for (const { source, front, url, title } of eachTitledPage(contentDir, routesDir)) {
|
|
69
|
+
docs.push({
|
|
70
|
+
path: url,
|
|
71
|
+
title,
|
|
72
|
+
section: typeof front.section === 'string' ? front.section : undefined,
|
|
73
|
+
description: typeof front.description === 'string' ? front.description : undefined,
|
|
74
|
+
headings: extractToc(source).map((entry) => entry.title),
|
|
75
|
+
text: extractSearchText(source)
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
return docs.sort((a, b) => a.path.localeCompare(b.path));
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Build the LLM records for every page: title, section, description, and the
|
|
82
|
+
* full markdown content. Served as the `svelte-docsmith/llms` virtual module and
|
|
83
|
+
* consumed server-side by `llms.txt` / `llms-full.txt` routes, so it never ships
|
|
84
|
+
* to the client.
|
|
85
|
+
*/
|
|
86
|
+
export function collectLlmsDocs(contentDir, routesDir) {
|
|
87
|
+
if (!fs.existsSync(contentDir))
|
|
88
|
+
return [];
|
|
89
|
+
const docs = [];
|
|
90
|
+
for (const { source, front, url, title } of eachTitledPage(contentDir, routesDir)) {
|
|
91
|
+
docs.push({
|
|
92
|
+
path: url,
|
|
93
|
+
title,
|
|
94
|
+
section: typeof front.section === 'string' ? front.section : undefined,
|
|
95
|
+
order: typeof front.order === 'number' ? front.order : undefined,
|
|
96
|
+
description: typeof front.description === 'string' ? front.description : undefined,
|
|
97
|
+
content: extractLlmsContent(source, title)
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
return docs.sort((a, b) => a.path.localeCompare(b.path));
|
|
101
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type TocEntry = {
|
|
2
|
+
id: string;
|
|
3
|
+
title: string;
|
|
4
|
+
depth: 2 | 3;
|
|
5
|
+
};
|
|
6
|
+
/** Strip inline markdown so a heading's TOC label is plain text. */
|
|
7
|
+
export declare function stripInlineMarkdown(text: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* Reduce a markdown page to plain, searchable body text: prose and heading text
|
|
10
|
+
* with frontmatter, `<script>`/`<style>` blocks, fenced code, HTML/Svelte tags,
|
|
11
|
+
* and markdown punctuation removed. Feeds the generated search index. Code
|
|
12
|
+
* samples are intentionally dropped to keep the index small and prose-focused.
|
|
13
|
+
*/
|
|
14
|
+
export declare function extractSearchText(source: string): string;
|
|
15
|
+
/** Estimated reading time in whole minutes from a page's plain-text body. */
|
|
16
|
+
export declare function readingMinutes(text: string): number;
|
|
17
|
+
/**
|
|
18
|
+
* Extract `h2`/`h3` headings from a markdown page so the in-page TOC can be
|
|
19
|
+
* server-rendered (no post-hydration pop-in). Skips fenced code blocks. Ids are
|
|
20
|
+
* produced with the same `github-slugger` that `rehype-slug` uses at render
|
|
21
|
+
* time — including its duplicate-suffixing — so the SSR anchors match the real
|
|
22
|
+
* heading ids exactly, not just for common cases.
|
|
23
|
+
*/
|
|
24
|
+
export declare function extractToc(source: string): TocEntry[];
|
|
25
|
+
/**
|
|
26
|
+
* The page's markdown body for LLM output: frontmatter and `<script>`/`<style>`
|
|
27
|
+
* blocks removed, everything else (headings, prose, code, component tags) kept,
|
|
28
|
+
* with the frontmatter title prepended as an `h1` (pages start their body at h2).
|
|
29
|
+
*/
|
|
30
|
+
export declare function extractLlmsContent(source: string, title: string): string;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import GithubSlugger from 'github-slugger';
|
|
2
|
+
/** Strip inline markdown so a heading's TOC label is plain text. */
|
|
3
|
+
export function stripInlineMarkdown(text) {
|
|
4
|
+
return text
|
|
5
|
+
.replace(/!\[([^\]]*)\]\([^)]*\)/g, '$1')
|
|
6
|
+
.replace(/`([^`]+)`/g, '$1')
|
|
7
|
+
.replace(/\*\*([^*]+)\*\*/g, '$1')
|
|
8
|
+
.replace(/\*([^*]+)\*/g, '$1')
|
|
9
|
+
.replace(/\[([^\]]+)\]\([^)]*\)/g, '$1')
|
|
10
|
+
.replace(/[_~]/g, '')
|
|
11
|
+
.trim();
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Reduce a markdown page to plain, searchable body text: prose and heading text
|
|
15
|
+
* with frontmatter, `<script>`/`<style>` blocks, fenced code, HTML/Svelte tags,
|
|
16
|
+
* and markdown punctuation removed. Feeds the generated search index. Code
|
|
17
|
+
* samples are intentionally dropped to keep the index small and prose-focused.
|
|
18
|
+
*/
|
|
19
|
+
export function extractSearchText(source) {
|
|
20
|
+
let body = source.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/, '');
|
|
21
|
+
// Component/setup blocks aren't prose; drop them whole before line scanning.
|
|
22
|
+
body = body.replace(/<script[\s\S]*?<\/script>/gi, '').replace(/<style[\s\S]*?<\/style>/gi, '');
|
|
23
|
+
const out = [];
|
|
24
|
+
let fence = null;
|
|
25
|
+
for (const line of body.split('\n')) {
|
|
26
|
+
const f = /^\s*(`{3,}|~{3,})/.exec(line);
|
|
27
|
+
if (f) {
|
|
28
|
+
const ch = f[1][0];
|
|
29
|
+
if (fence === null)
|
|
30
|
+
fence = ch;
|
|
31
|
+
else if (ch === fence)
|
|
32
|
+
fence = null;
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
if (fence !== null)
|
|
36
|
+
continue;
|
|
37
|
+
// Skip table delimiter rows (`| --- | :--: |`) — pure structure, no words.
|
|
38
|
+
if (/^\s*\|?[\s:|-]+\|[\s:|-]*$/.test(line))
|
|
39
|
+
continue;
|
|
40
|
+
const text = stripInlineMarkdown(line
|
|
41
|
+
.replace(/<[^>]+>/g, ' ') // strip HTML/Svelte tags, keep their text content
|
|
42
|
+
.replace(/^\s{0,3}#{1,6}\s+/, '') // heading markers
|
|
43
|
+
.replace(/^\s{0,3}>\s?/, '') // blockquote markers
|
|
44
|
+
.replace(/^\s*[-*+]\s+/, '') // unordered list bullets
|
|
45
|
+
.replace(/^\s*\d+\.\s+/, '') // ordered list markers
|
|
46
|
+
.replace(/\s*\|\s*/g, ' ') // table cell separators → spaces, not "| a | b |"
|
|
47
|
+
).replace(/\s+/g, ' ');
|
|
48
|
+
if (text)
|
|
49
|
+
out.push(text);
|
|
50
|
+
}
|
|
51
|
+
return out.join(' ');
|
|
52
|
+
}
|
|
53
|
+
/** Estimated reading time in whole minutes from a page's plain-text body. */
|
|
54
|
+
export function readingMinutes(text) {
|
|
55
|
+
const words = text.split(/\s+/).filter(Boolean).length;
|
|
56
|
+
return Math.max(1, Math.round(words / 200));
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Extract `h2`/`h3` headings from a markdown page so the in-page TOC can be
|
|
60
|
+
* server-rendered (no post-hydration pop-in). Skips fenced code blocks. Ids are
|
|
61
|
+
* produced with the same `github-slugger` that `rehype-slug` uses at render
|
|
62
|
+
* time — including its duplicate-suffixing — so the SSR anchors match the real
|
|
63
|
+
* heading ids exactly, not just for common cases.
|
|
64
|
+
*/
|
|
65
|
+
export function extractToc(source) {
|
|
66
|
+
const body = source.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/, '');
|
|
67
|
+
const slugger = new GithubSlugger();
|
|
68
|
+
const toc = [];
|
|
69
|
+
let fence = null;
|
|
70
|
+
for (const line of body.split('\n')) {
|
|
71
|
+
const f = /^\s*(`{3,}|~{3,})/.exec(line);
|
|
72
|
+
if (f) {
|
|
73
|
+
const ch = f[1][0];
|
|
74
|
+
if (fence === null)
|
|
75
|
+
fence = ch;
|
|
76
|
+
else if (ch === fence)
|
|
77
|
+
fence = null;
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
if (fence !== null)
|
|
81
|
+
continue;
|
|
82
|
+
const m = /^(#{2,3})\s+(.+?)\s*#*\s*$/.exec(line);
|
|
83
|
+
if (!m)
|
|
84
|
+
continue;
|
|
85
|
+
const title = stripInlineMarkdown(m[2]);
|
|
86
|
+
if (!title)
|
|
87
|
+
continue;
|
|
88
|
+
toc.push({ id: slugger.slug(title), title, depth: m[1].length });
|
|
89
|
+
}
|
|
90
|
+
return toc;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* The page's markdown body for LLM output: frontmatter and `<script>`/`<style>`
|
|
94
|
+
* blocks removed, everything else (headings, prose, code, component tags) kept,
|
|
95
|
+
* with the frontmatter title prepended as an `h1` (pages start their body at h2).
|
|
96
|
+
*/
|
|
97
|
+
export function extractLlmsContent(source, title) {
|
|
98
|
+
const body = source
|
|
99
|
+
.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/, '')
|
|
100
|
+
.replace(/<script[\s\S]*?<\/script>/gi, '')
|
|
101
|
+
.replace(/<style[\s\S]*?<\/style>/gi, '')
|
|
102
|
+
.trim();
|
|
103
|
+
return `# ${title}\n\n${body}`;
|
|
104
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parse a page's leading YAML frontmatter block into a plain object. Returns an
|
|
3
|
+
* empty object when there is no frontmatter; throws a located error on invalid
|
|
4
|
+
* YAML so a typo surfaces with its filename instead of a blank page.
|
|
5
|
+
*/
|
|
6
|
+
export declare function parseFrontmatter(source: string, file: string): Record<string, unknown>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import yaml from 'js-yaml';
|
|
2
|
+
/**
|
|
3
|
+
* Parse a page's leading YAML frontmatter block into a plain object. Returns an
|
|
4
|
+
* empty object when there is no frontmatter; throws a located error on invalid
|
|
5
|
+
* YAML so a typo surfaces with its filename instead of a blank page.
|
|
6
|
+
*/
|
|
7
|
+
export function parseFrontmatter(source, file) {
|
|
8
|
+
const match = /^---\r?\n([\s\S]*?)\r?\n---/.exec(source);
|
|
9
|
+
if (!match)
|
|
10
|
+
return {};
|
|
11
|
+
let data;
|
|
12
|
+
try {
|
|
13
|
+
data = yaml.load(match[1]);
|
|
14
|
+
}
|
|
15
|
+
catch (err) {
|
|
16
|
+
const reason = err instanceof Error ? err.message : String(err);
|
|
17
|
+
throw new Error(`[svelte-docsmith] invalid YAML frontmatter in ${file}\n${reason}`);
|
|
18
|
+
}
|
|
19
|
+
return data && typeof data === 'object' ? data : {};
|
|
20
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { spawnSync } from 'node:child_process';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
/** Last git commit date (strict ISO) for a file, or undefined outside a repo. */
|
|
4
|
+
export function lastCommitDate(file) {
|
|
5
|
+
const res = spawnSync('git', ['log', '-1', '--format=%cI', '--', file], {
|
|
6
|
+
cwd: path.dirname(file),
|
|
7
|
+
encoding: 'utf-8'
|
|
8
|
+
});
|
|
9
|
+
const date = res.status === 0 ? res.stdout.trim() : '';
|
|
10
|
+
return date || undefined;
|
|
11
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Plugin } from 'vite';
|
|
2
|
+
export { collectDocs, collectLlmsDocs, collectSearchDocs } from './collect.js';
|
|
3
|
+
export interface DocsmithViteOptions {
|
|
4
|
+
/** Directory scanned for doc pages. Default: `'src/routes/docs'`. */
|
|
5
|
+
content?: string;
|
|
6
|
+
/**
|
|
7
|
+
* Routes root used to derive each page's URL from its location.
|
|
8
|
+
* Default: `'src/routes'` (so `src/routes/docs/intro/+page.md` → `/docs/intro`).
|
|
9
|
+
*/
|
|
10
|
+
routes?: string;
|
|
11
|
+
/** Shiki themes for the `?source` render. Default: github-light/github-dark. */
|
|
12
|
+
themes?: {
|
|
13
|
+
light: string;
|
|
14
|
+
dark: string;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The svelte-docsmith Vite plugin. Add it to `plugins` in `vite.config.ts`:
|
|
19
|
+
*
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { docsmith } from 'svelte-docsmith/vite';
|
|
22
|
+
* export default defineConfig({ plugins: [docsmith(), tailwindcss(), sveltekit()] });
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function docsmith(options?: DocsmithViteOptions): Plugin[];
|
|
@@ -0,0 +1,141 @@
|
|
|
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. (An `svelte-docsmith/llms`
|
|
12
|
+
* index of full markdown bodies is wired the same way.)
|
|
13
|
+
* 3. The **`?source` transform** powering `LiveExample`: importing
|
|
14
|
+
* `Component.svelte?source` yields that file's Shiki-highlighted source.
|
|
15
|
+
*
|
|
16
|
+
* The per-index scanning lives in `./collect.js`; this file owns the two Vite
|
|
17
|
+
* plugins and re-exports the collectors for consumers and tests.
|
|
18
|
+
*/
|
|
19
|
+
import fs from 'node:fs';
|
|
20
|
+
import path from 'node:path';
|
|
21
|
+
import { DEFAULT_THEMES, lazyHighlighter } from '../highlight.js';
|
|
22
|
+
import { isPageFile, listPageFiles } from './pages.js';
|
|
23
|
+
import { collectDocs, collectLlmsDocs, collectSearchDocs } from './collect.js';
|
|
24
|
+
export { collectDocs, collectLlmsDocs, collectSearchDocs } from './collect.js';
|
|
25
|
+
/**
|
|
26
|
+
* The svelte-docsmith Vite plugin. Add it to `plugins` in `vite.config.ts`:
|
|
27
|
+
*
|
|
28
|
+
* ```ts
|
|
29
|
+
* import { docsmith } from 'svelte-docsmith/vite';
|
|
30
|
+
* export default defineConfig({ plugins: [docsmith(), tailwindcss(), sveltekit()] });
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export function docsmith(options = {}) {
|
|
34
|
+
return [contentIndexPlugin(options), exampleSourcePlugin(options)];
|
|
35
|
+
}
|
|
36
|
+
// --- content / search / llms index --------------------------------------
|
|
37
|
+
const CONTENT_SPECIFIER = 'svelte-docsmith/content';
|
|
38
|
+
const VIRTUAL_CONTENT_ID = '\0svelte-docsmith:content';
|
|
39
|
+
const SEARCH_SPECIFIER = 'svelte-docsmith/search';
|
|
40
|
+
const VIRTUAL_SEARCH_ID = '\0svelte-docsmith:search';
|
|
41
|
+
const LLMS_SPECIFIER = 'svelte-docsmith/llms';
|
|
42
|
+
const VIRTUAL_LLMS_ID = '\0svelte-docsmith:llms';
|
|
43
|
+
function contentIndexPlugin(options) {
|
|
44
|
+
const contentDir = path.resolve(options.content ?? 'src/routes/docs');
|
|
45
|
+
const routesDir = path.resolve(options.routes ?? 'src/routes');
|
|
46
|
+
return {
|
|
47
|
+
name: 'docsmith-content',
|
|
48
|
+
enforce: 'pre',
|
|
49
|
+
resolveId(id) {
|
|
50
|
+
if (id === CONTENT_SPECIFIER)
|
|
51
|
+
return VIRTUAL_CONTENT_ID;
|
|
52
|
+
if (id === SEARCH_SPECIFIER)
|
|
53
|
+
return VIRTUAL_SEARCH_ID;
|
|
54
|
+
if (id === LLMS_SPECIFIER)
|
|
55
|
+
return VIRTUAL_LLMS_ID;
|
|
56
|
+
},
|
|
57
|
+
load(id) {
|
|
58
|
+
// Watch each page file (not the directory) so editing frontmatter or
|
|
59
|
+
// body re-runs this load. A directory here is treated as an
|
|
60
|
+
// unresolvable import by vite:import-analysis; new/removed pages are
|
|
61
|
+
// handled by the watcher in configureServer.
|
|
62
|
+
if (id === VIRTUAL_CONTENT_ID) {
|
|
63
|
+
for (const file of listPageFiles(contentDir))
|
|
64
|
+
this.addWatchFile(file);
|
|
65
|
+
const docs = collectDocs(contentDir, routesDir);
|
|
66
|
+
return `export const docs = ${JSON.stringify(docs, null, 2)};\n`;
|
|
67
|
+
}
|
|
68
|
+
if (id === VIRTUAL_SEARCH_ID) {
|
|
69
|
+
for (const file of listPageFiles(contentDir))
|
|
70
|
+
this.addWatchFile(file);
|
|
71
|
+
const docs = collectSearchDocs(contentDir, routesDir);
|
|
72
|
+
return `export const docs = ${JSON.stringify(docs)};\n`;
|
|
73
|
+
}
|
|
74
|
+
if (id === VIRTUAL_LLMS_ID) {
|
|
75
|
+
for (const file of listPageFiles(contentDir))
|
|
76
|
+
this.addWatchFile(file);
|
|
77
|
+
const docs = collectLlmsDocs(contentDir, routesDir);
|
|
78
|
+
return `export const docs = ${JSON.stringify(docs)};\n`;
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
configureServer(server) {
|
|
82
|
+
server.watcher.add(contentDir);
|
|
83
|
+
const onChange = (file) => {
|
|
84
|
+
if (!isPageFile(file))
|
|
85
|
+
return;
|
|
86
|
+
let invalidated = false;
|
|
87
|
+
for (const virtualId of [VIRTUAL_CONTENT_ID, VIRTUAL_SEARCH_ID, VIRTUAL_LLMS_ID]) {
|
|
88
|
+
const mod = server.moduleGraph.getModuleById(virtualId);
|
|
89
|
+
if (!mod)
|
|
90
|
+
continue;
|
|
91
|
+
server.moduleGraph.invalidateModule(mod);
|
|
92
|
+
invalidated = true;
|
|
93
|
+
}
|
|
94
|
+
if (invalidated)
|
|
95
|
+
server.ws.send({ type: 'full-reload' });
|
|
96
|
+
};
|
|
97
|
+
server.watcher.on('add', onChange);
|
|
98
|
+
server.watcher.on('unlink', onChange);
|
|
99
|
+
server.watcher.on('change', onChange);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
// --- ?source transform (LiveExample) ------------------------------------
|
|
104
|
+
const SOURCE_PREFIX = '\0docsmith-source:';
|
|
105
|
+
// The virtual id must NOT end in `.svelte`, or vite-plugin-svelte will try to
|
|
106
|
+
// compile the highlighted-HTML string as a component.
|
|
107
|
+
const SOURCE_EXT = '.docsmith-src';
|
|
108
|
+
const SOURCE_SUFFIX = '?source';
|
|
109
|
+
function exampleSourcePlugin(options) {
|
|
110
|
+
const themes = options.themes ?? DEFAULT_THEMES;
|
|
111
|
+
const getHighlighter = lazyHighlighter([themes.light, themes.dark], ['svelte']);
|
|
112
|
+
return {
|
|
113
|
+
name: 'docsmith-example-source',
|
|
114
|
+
enforce: 'pre',
|
|
115
|
+
async resolveId(id, importer) {
|
|
116
|
+
if (!id.endsWith('.svelte' + SOURCE_SUFFIX))
|
|
117
|
+
return;
|
|
118
|
+
const base = id.slice(0, -SOURCE_SUFFIX.length);
|
|
119
|
+
const resolved = await this.resolve(base, importer, { skipSelf: true });
|
|
120
|
+
if (resolved)
|
|
121
|
+
return SOURCE_PREFIX + resolved.id + SOURCE_EXT;
|
|
122
|
+
},
|
|
123
|
+
async load(id) {
|
|
124
|
+
if (!id.startsWith(SOURCE_PREFIX))
|
|
125
|
+
return;
|
|
126
|
+
const file = id.slice(SOURCE_PREFIX.length, -SOURCE_EXT.length);
|
|
127
|
+
this.addWatchFile(file);
|
|
128
|
+
const code = fs.readFileSync(file, 'utf-8').trimEnd();
|
|
129
|
+
const highlighter = await getHighlighter();
|
|
130
|
+
// Strip Shiki's own surface (the inline light `background-color` and the
|
|
131
|
+
// `--shiki-dark-bg` var) so the highlighted source sits on the
|
|
132
|
+
// consuming component's token background — matching markdown code blocks,
|
|
133
|
+
// and never flashing Shiki's default before component CSS applies.
|
|
134
|
+
const html = highlighter
|
|
135
|
+
.codeToHtml(code, { lang: 'svelte', themes })
|
|
136
|
+
.replace(/background-color:[^;"]*;?/gi, '')
|
|
137
|
+
.replace(/--shiki-dark-bg:[^;"]*;?/gi, '');
|
|
138
|
+
return `export default ${JSON.stringify(html)};`;
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Whether a filename is a doc page the plugin should index. */
|
|
2
|
+
export declare function isPageFile(file: string): boolean;
|
|
3
|
+
/**
|
|
4
|
+
* List the absolute paths of every `+page.md`/`+page.svx` under `contentDir`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function listPageFiles(contentDir: string): string[];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
const PAGE_NAMES = ['+page.md', '+page.svx'];
|
|
4
|
+
/** Whether a filename is a doc page the plugin should index. */
|
|
5
|
+
export function isPageFile(file) {
|
|
6
|
+
return PAGE_NAMES.some((name) => file.endsWith(name));
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* List the absolute paths of every `+page.md`/`+page.svx` under `contentDir`.
|
|
10
|
+
*/
|
|
11
|
+
export function listPageFiles(contentDir) {
|
|
12
|
+
if (!fs.existsSync(contentDir))
|
|
13
|
+
return [];
|
|
14
|
+
const entries = fs.readdirSync(contentDir, { recursive: true, withFileTypes: true });
|
|
15
|
+
const files = [];
|
|
16
|
+
for (const entry of entries) {
|
|
17
|
+
if (!entry.isFile() || !isPageFile(entry.name))
|
|
18
|
+
continue;
|
|
19
|
+
const dir = entry.parentPath ?? entry.path ?? contentDir;
|
|
20
|
+
files.push(path.join(dir, entry.name));
|
|
21
|
+
}
|
|
22
|
+
return files;
|
|
23
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { goto } from '$app/navigation';
|
|
3
|
-
import * as Command from '
|
|
4
|
-
import { useSearch } from '
|
|
5
|
-
import type { SearchDoc } from '
|
|
6
|
-
import type { SearchEngine } from '
|
|
3
|
+
import * as Command from '../shadcn/command/index.js';
|
|
4
|
+
import { useSearch } from '../../search/context.svelte.js';
|
|
5
|
+
import type { SearchDoc } from '../../core/index.js';
|
|
6
|
+
import type { SearchEngine } from '../../search/create-search.js';
|
|
7
7
|
import CornerDownLeft from '@lucide/svelte/icons/corner-down-left';
|
|
8
8
|
import FileText from '@lucide/svelte/icons/file-text';
|
|
9
9
|
import LoaderCircle from '@lucide/svelte/icons/loader-circle';
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
status = 'loading';
|
|
38
38
|
try {
|
|
39
39
|
const [{ createSearchEngine }, docs] = await Promise.all([
|
|
40
|
-
import('
|
|
40
|
+
import('../../search/create-search.js'),
|
|
41
41
|
load()
|
|
42
42
|
]);
|
|
43
43
|
engine = createSearchEngine(docs);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { Button } from '
|
|
2
|
+
import { Button } from '../shadcn/button/index.js';
|
|
3
3
|
import Moon from '@lucide/svelte/icons/moon';
|
|
4
4
|
import Sun from '@lucide/svelte/icons/sun';
|
|
5
5
|
import { mode, toggleMode } from 'mode-watcher';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { useClipboard } from '
|
|
3
|
-
import { Button } from '
|
|
4
|
-
import CopyButton from '
|
|
2
|
+
import { useClipboard } from '../../utils/clipboard.svelte.js';
|
|
3
|
+
import { Button } from '../shadcn/button/index.js';
|
|
4
|
+
import CopyButton from '../chrome/copy-button.svelte';
|
|
5
5
|
import Code from '@lucide/svelte/icons/code';
|
|
6
6
|
import type { Snippet } from 'svelte';
|
|
7
7
|
|