fromsrc 0.0.0 → 0.0.2
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 +49 -0
- package/dist/access.d.ts +23 -0
- package/dist/access.js +54 -0
- package/dist/adapter.d.ts +31 -0
- package/dist/adapter.js +59 -0
- package/dist/adapterastro.d.ts +6 -0
- package/dist/adapterastro.js +6 -0
- package/dist/adapterbrowser.d.ts +6 -0
- package/dist/adapterbrowser.js +38 -0
- package/dist/adapternext.d.ts +6 -0
- package/dist/adapternext.js +49 -0
- package/dist/adapterreactrouter.d.ts +6 -0
- package/dist/adapterreactrouter.js +37 -0
- package/dist/adapterremix.d.ts +6 -0
- package/dist/adapterremix.js +41 -0
- package/dist/adaptertanstack.d.ts +6 -0
- package/dist/adaptertanstack.js +38 -0
- package/dist/adaptervite.d.ts +6 -0
- package/dist/adaptervite.js +6 -0
- package/dist/algolia.d.ts +16 -0
- package/dist/algolia.js +83 -0
- package/dist/analytics.d.ts +31 -0
- package/dist/analytics.js +61 -0
- package/dist/ansi.d.ts +5 -0
- package/dist/ansi.js +192 -0
- package/dist/api.d.ts +30 -0
- package/dist/api.js +75 -0
- package/dist/astro.d.ts +3 -0
- package/dist/astro.js +3 -0
- package/dist/audit.d.ts +19 -0
- package/dist/audit.js +78 -0
- package/dist/autotype.d.ts +17 -0
- package/dist/autotype.js +73 -0
- package/dist/batch.d.ts +22 -0
- package/dist/batch.js +68 -0
- package/dist/browser.d.ts +5 -0
- package/dist/browser.js +53 -0
- package/dist/changelog.d.ts +27 -0
- package/dist/changelog.js +87 -0
- package/dist/changelogutil.d.ts +20 -0
- package/dist/changelogutil.js +84 -0
- package/dist/cli.d.ts +24 -0
- package/dist/cli.js +76 -0
- package/dist/client.d.ts +212 -0
- package/dist/client.js +202 -0
- package/dist/codesample.d.ts +20 -0
- package/dist/codesample.js +115 -0
- package/dist/collapse.d.ts +5 -0
- package/dist/collapse.js +101 -0
- package/dist/collections.d.ts +32 -0
- package/dist/collections.js +82 -0
- package/dist/components/accordion.d.ts +22 -0
- package/dist/components/accordion.js +54 -0
- package/dist/components/alert.d.ts +18 -0
- package/dist/components/alert.js +30 -0
- package/dist/components/announce.d.ts +11 -0
- package/dist/components/announce.js +38 -0
- package/dist/components/autofill.d.ts +27 -0
- package/dist/components/autofill.js +152 -0
- package/dist/components/avatar.d.ts +42 -0
- package/dist/components/avatar.js +67 -0
- package/dist/components/avatarstack.d.ts +23 -0
- package/dist/components/avatarstack.js +54 -0
- package/dist/components/backtotop.d.ts +20 -0
- package/dist/components/backtotop.js +42 -0
- package/dist/components/badge.d.ts +17 -0
- package/dist/components/badge.js +25 -0
- package/dist/components/banner.d.ts +21 -0
- package/dist/components/banner.js +63 -0
- package/dist/components/breadcrumb.d.ts +25 -0
- package/dist/components/breadcrumb.js +35 -0
- package/dist/components/breadcrumbnav.d.ts +15 -0
- package/dist/components/breadcrumbnav.js +60 -0
- package/dist/components/button.d.ts +22 -0
- package/dist/components/button.js +47 -0
- package/dist/components/callout.d.ts +26 -0
- package/dist/components/callout.js +91 -0
- package/dist/components/cards.d.ts +34 -0
- package/dist/components/cards.js +24 -0
- package/dist/components/changelog.d.ts +34 -0
- package/dist/components/changelog.js +50 -0
- package/dist/components/checkbox.d.ts +26 -0
- package/dist/components/checkbox.js +80 -0
- package/dist/components/code.d.ts +27 -0
- package/dist/components/code.js +36 -0
- package/dist/components/codeblock.d.ts +12 -0
- package/dist/components/codeblock.js +102 -0
- package/dist/components/codecopy.d.ts +12 -0
- package/dist/components/codecopy.js +56 -0
- package/dist/components/codegroup.d.ts +22 -0
- package/dist/components/codegroup.js +134 -0
- package/dist/components/collapsible.d.ts +29 -0
- package/dist/components/collapsible.js +64 -0
- package/dist/components/command.d.ts +22 -0
- package/dist/components/command.js +138 -0
- package/dist/components/compare.d.ts +54 -0
- package/dist/components/compare.js +88 -0
- package/dist/components/content.d.ts +12 -0
- package/dist/components/content.js +232 -0
- package/dist/components/copyable.d.ts +25 -0
- package/dist/components/copyable.js +51 -0
- package/dist/components/copybutton.d.ts +11 -0
- package/dist/components/copybutton.js +50 -0
- package/dist/components/countdown.d.ts +18 -0
- package/dist/components/countdown.js +112 -0
- package/dist/components/create.d.ts +10 -0
- package/dist/components/create.js +149 -0
- package/dist/components/definition.d.ts +43 -0
- package/dist/components/definition.js +46 -0
- package/dist/components/diffview.d.ts +12 -0
- package/dist/components/diffview.js +129 -0
- package/dist/components/divider.d.ts +19 -0
- package/dist/components/divider.js +24 -0
- package/dist/components/docheader.d.ts +17 -0
- package/dist/components/docheader.js +24 -0
- package/dist/components/doclinkcard.d.ts +19 -0
- package/dist/components/doclinkcard.js +37 -0
- package/dist/components/docslayout.d.ts +14 -0
- package/dist/components/docslayout.js +24 -0
- package/dist/components/dropdown.d.ts +23 -0
- package/dist/components/dropdown.js +134 -0
- package/dist/components/dynamiccode.d.ts +12 -0
- package/dist/components/dynamiccode.js +40 -0
- package/dist/components/editlink.d.ts +15 -0
- package/dist/components/editlink.js +45 -0
- package/dist/components/embed.d.ts +45 -0
- package/dist/components/embed.js +85 -0
- package/dist/components/endpoint.d.ts +58 -0
- package/dist/components/endpoint.js +100 -0
- package/dist/components/errormessage.d.ts +11 -0
- package/dist/components/errormessage.js +10 -0
- package/dist/components/expandcode.d.ts +13 -0
- package/dist/components/expandcode.js +58 -0
- package/dist/components/feature.d.ts +31 -0
- package/dist/components/feature.js +58 -0
- package/dist/components/featuregrid.d.ts +17 -0
- package/dist/components/featuregrid.js +36 -0
- package/dist/components/feedback.d.ts +14 -0
- package/dist/components/feedback.js +62 -0
- package/dist/components/feedbackwidget.d.ts +14 -0
- package/dist/components/feedbackwidget.js +106 -0
- package/dist/components/files.d.ts +21 -0
- package/dist/components/files.js +133 -0
- package/dist/components/folder.d.ts +15 -0
- package/dist/components/folder.js +102 -0
- package/dist/components/footer.d.ts +16 -0
- package/dist/components/footer.js +28 -0
- package/dist/components/formlabel.d.ts +24 -0
- package/dist/components/formlabel.js +27 -0
- package/dist/components/github.d.ts +14 -0
- package/dist/components/github.js +99 -0
- package/dist/components/graph.d.ts +36 -0
- package/dist/components/graph.js +210 -0
- package/dist/components/heading.d.ts +25 -0
- package/dist/components/heading.js +82 -0
- package/dist/components/headingcopy.d.ts +3 -0
- package/dist/components/headingcopy.js +31 -0
- package/dist/components/hero.d.ts +16 -0
- package/dist/components/hero.js +28 -0
- package/dist/components/highlight.d.ts +41 -0
- package/dist/components/highlight.js +42 -0
- package/dist/components/hover.d.ts +23 -0
- package/dist/components/hover.js +79 -0
- package/dist/components/icons.d.ts +30 -0
- package/dist/components/icons.js +419 -0
- package/dist/components/inlinetoc.d.ts +19 -0
- package/dist/components/inlinetoc.js +28 -0
- package/dist/components/input.d.ts +25 -0
- package/dist/components/input.js +42 -0
- package/dist/components/install.d.ts +10 -0
- package/dist/components/install.js +149 -0
- package/dist/components/kbd.d.ts +22 -0
- package/dist/components/kbd.js +30 -0
- package/dist/components/langicon.d.ts +8 -0
- package/dist/components/langicon.js +48 -0
- package/dist/components/language.d.ts +17 -0
- package/dist/components/language.js +123 -0
- package/dist/components/lastupdated.d.ts +12 -0
- package/dist/components/lastupdated.js +44 -0
- package/dist/components/link.d.ts +14 -0
- package/dist/components/link.js +53 -0
- package/dist/components/linkcard.d.ts +33 -0
- package/dist/components/linkcard.js +50 -0
- package/dist/components/list.d.ts +50 -0
- package/dist/components/list.js +55 -0
- package/dist/components/math.d.ts +34 -0
- package/dist/components/math.js +63 -0
- package/dist/components/mermaid.d.ts +19 -0
- package/dist/components/mermaid.js +79 -0
- package/dist/components/mobilenav.d.ts +17 -0
- package/dist/components/mobilenav.js +263 -0
- package/dist/components/modal.d.ts +18 -0
- package/dist/components/modal.js +69 -0
- package/dist/components/navbar.d.ts +19 -0
- package/dist/components/navbar.js +45 -0
- package/dist/components/navlink.d.ts +14 -0
- package/dist/components/navlink.js +77 -0
- package/dist/components/note.d.ts +28 -0
- package/dist/components/note.js +60 -0
- package/dist/components/openapi.d.ts +14 -0
- package/dist/components/openapi.js +145 -0
- package/dist/components/openapischema.d.ts +13 -0
- package/dist/components/openapischema.js +51 -0
- package/dist/components/openapitags.d.ts +13 -0
- package/dist/components/openapitags.js +20 -0
- package/dist/components/pagetransition.d.ts +13 -0
- package/dist/components/pagetransition.js +37 -0
- package/dist/components/pagination.d.ts +26 -0
- package/dist/components/pagination.js +68 -0
- package/dist/components/panel.d.ts +25 -0
- package/dist/components/panel.js +75 -0
- package/dist/components/playground.d.ts +14 -0
- package/dist/components/playground.js +89 -0
- package/dist/components/popover.d.ts +18 -0
- package/dist/components/popover.js +109 -0
- package/dist/components/prelink.d.ts +10 -0
- package/dist/components/prelink.js +46 -0
- package/dist/components/prevnext.d.ts +17 -0
- package/dist/components/prevnext.js +43 -0
- package/dist/components/progress.d.ts +30 -0
- package/dist/components/progress.js +74 -0
- package/dist/components/property.d.ts +24 -0
- package/dist/components/property.js +44 -0
- package/dist/components/quote.d.ts +44 -0
- package/dist/components/quote.js +41 -0
- package/dist/components/radio.d.ts +48 -0
- package/dist/components/radio.js +140 -0
- package/dist/components/rating.d.ts +22 -0
- package/dist/components/rating.js +100 -0
- package/dist/components/readtime.d.ts +17 -0
- package/dist/components/readtime.js +26 -0
- package/dist/components/recent.d.ts +12 -0
- package/dist/components/recent.js +23 -0
- package/dist/components/responsive.d.ts +35 -0
- package/dist/components/responsive.js +73 -0
- package/dist/components/results.d.ts +20 -0
- package/dist/components/results.js +72 -0
- package/dist/components/screenshot.d.ts +33 -0
- package/dist/components/screenshot.js +52 -0
- package/dist/components/scrollprogress.d.ts +12 -0
- package/dist/components/scrollprogress.js +56 -0
- package/dist/components/scrollspy.d.ts +18 -0
- package/dist/components/scrollspy.js +51 -0
- package/dist/components/search.d.ts +19 -0
- package/dist/components/search.js +228 -0
- package/dist/components/searchbutton.d.ts +10 -0
- package/dist/components/searchbutton.js +51 -0
- package/dist/components/searchdialog.d.ts +19 -0
- package/dist/components/searchdialog.js +108 -0
- package/dist/components/searcher.d.ts +12 -0
- package/dist/components/searcher.js +121 -0
- package/dist/components/select.d.ts +39 -0
- package/dist/components/select.js +162 -0
- package/dist/components/shortcuts.d.ts +17 -0
- package/dist/components/shortcuts.js +62 -0
- package/dist/components/sidebar.d.ts +35 -0
- package/dist/components/sidebar.js +215 -0
- package/dist/components/sidebarfilter.d.ts +13 -0
- package/dist/components/sidebarfilter.js +50 -0
- package/dist/components/skeleton.d.ts +40 -0
- package/dist/components/skeleton.js +59 -0
- package/dist/components/skiplink.d.ts +12 -0
- package/dist/components/skiplink.js +21 -0
- package/dist/components/spinner.d.ts +34 -0
- package/dist/components/spinner.js +56 -0
- package/dist/components/status.d.ts +27 -0
- package/dist/components/status.js +63 -0
- package/dist/components/steps.d.ts +30 -0
- package/dist/components/steps.js +15 -0
- package/dist/components/switch.d.ts +26 -0
- package/dist/components/switch.js +79 -0
- package/dist/components/table.d.ts +36 -0
- package/dist/components/table.js +138 -0
- package/dist/components/tabnav.d.ts +30 -0
- package/dist/components/tabnav.js +199 -0
- package/dist/components/tabs.d.ts +15 -0
- package/dist/components/tabs.js +96 -0
- package/dist/components/tag.d.ts +32 -0
- package/dist/components/tag.js +38 -0
- package/dist/components/terminal.d.ts +48 -0
- package/dist/components/terminal.js +62 -0
- package/dist/components/textarea.d.ts +30 -0
- package/dist/components/textarea.js +100 -0
- package/dist/components/theme.d.ts +11 -0
- package/dist/components/theme.js +66 -0
- package/dist/components/themeprovider.d.ts +19 -0
- package/dist/components/themeprovider.js +58 -0
- package/dist/components/toast.d.ts +31 -0
- package/dist/components/toast.js +107 -0
- package/dist/components/toc/default.d.ts +21 -0
- package/dist/components/toc/default.js +100 -0
- package/dist/components/toc/hook.d.ts +13 -0
- package/dist/components/toc/hook.js +125 -0
- package/dist/components/toc/index.d.ts +15 -0
- package/dist/components/toc/index.js +44 -0
- package/dist/components/toc/inline.d.ts +20 -0
- package/dist/components/toc/inline.js +75 -0
- package/dist/components/toc/minimal.d.ts +22 -0
- package/dist/components/toc/minimal.js +136 -0
- package/dist/components/toc/zigzag.d.ts +18 -0
- package/dist/components/toc/zigzag.js +57 -0
- package/dist/components/tocprogress.d.ts +17 -0
- package/dist/components/tocprogress.js +67 -0
- package/dist/components/tooltip.d.ts +19 -0
- package/dist/components/tooltip.js +76 -0
- package/dist/components/trigger.d.ts +8 -0
- package/dist/components/trigger.js +13 -0
- package/dist/components/twoslash.d.ts +9 -0
- package/dist/components/twoslash.js +52 -0
- package/dist/components/typetable.d.ts +21 -0
- package/dist/components/typetable.js +68 -0
- package/dist/components/typewriter.d.ts +20 -0
- package/dist/components/typewriter.js +50 -0
- package/dist/components/version.d.ts +29 -0
- package/dist/components/version.js +181 -0
- package/dist/components/video.d.ts +33 -0
- package/dist/components/video.js +147 -0
- package/dist/components/zoom.d.ts +9 -0
- package/dist/components/zoom.js +110 -0
- package/dist/config.d.ts +54 -0
- package/dist/config.js +102 -0
- package/dist/content.d.ts +83 -0
- package/dist/content.js +464 -0
- package/dist/contentcache.d.ts +28 -0
- package/dist/contentcache.js +76 -0
- package/dist/contentdiff.d.ts +19 -0
- package/dist/contentdiff.js +48 -0
- package/dist/contributors.d.ts +22 -0
- package/dist/contributors.js +64 -0
- package/dist/diff.d.ts +25 -0
- package/dist/diff.js +117 -0
- package/dist/draft.d.ts +33 -0
- package/dist/draft.js +62 -0
- package/dist/env.d.ts +12 -0
- package/dist/env.js +50 -0
- package/dist/export.d.ts +9 -0
- package/dist/export.js +32 -0
- package/dist/frontmatter.d.ts +19 -0
- package/dist/frontmatter.js +65 -0
- package/dist/github.d.ts +15 -0
- package/dist/github.js +254 -0
- package/dist/gitsource.d.ts +23 -0
- package/dist/gitsource.js +50 -0
- package/dist/hash.d.ts +21 -0
- package/dist/hash.js +65 -0
- package/dist/highlight.d.ts +18 -0
- package/dist/highlight.js +90 -0
- package/dist/hooks/anchor.d.ts +7 -0
- package/dist/hooks/anchor.js +44 -0
- package/dist/hooks/arrownav.d.ts +11 -0
- package/dist/hooks/arrownav.js +49 -0
- package/dist/hooks/async.d.ts +9 -0
- package/dist/hooks/async.js +28 -0
- package/dist/hooks/battery.d.ts +8 -0
- package/dist/hooks/battery.js +34 -0
- package/dist/hooks/breakpoint.d.ts +6 -0
- package/dist/hooks/breakpoint.js +34 -0
- package/dist/hooks/clickoutside.d.ts +11 -0
- package/dist/hooks/clickoutside.js +19 -0
- package/dist/hooks/clipboard-paste.d.ts +8 -0
- package/dist/hooks/clipboard-paste.js +18 -0
- package/dist/hooks/clipboard.d.ts +9 -0
- package/dist/hooks/clipboard.js +24 -0
- package/dist/hooks/colorscheme.d.ts +4 -0
- package/dist/hooks/colorscheme.js +18 -0
- package/dist/hooks/copy.d.ts +12 -0
- package/dist/hooks/copy.js +28 -0
- package/dist/hooks/countdown.d.ts +10 -0
- package/dist/hooks/countdown.js +41 -0
- package/dist/hooks/counter.d.ts +10 -0
- package/dist/hooks/counter.js +12 -0
- package/dist/hooks/debounce.d.ts +9 -0
- package/dist/hooks/debounce.js +16 -0
- package/dist/hooks/documenttitle.d.ts +3 -0
- package/dist/hooks/documenttitle.js +20 -0
- package/dist/hooks/documentvisibility.d.ts +4 -0
- package/dist/hooks/documentvisibility.js +19 -0
- package/dist/hooks/escapekey.d.ts +8 -0
- package/dist/hooks/escapekey.js +18 -0
- package/dist/hooks/eventlistener.d.ts +13 -0
- package/dist/hooks/eventlistener.js +15 -0
- package/dist/hooks/eventsource.d.ts +10 -0
- package/dist/hooks/eventsource.js +31 -0
- package/dist/hooks/eyedropper.d.ts +8 -0
- package/dist/hooks/eyedropper.js +23 -0
- package/dist/hooks/favicon.d.ts +3 -0
- package/dist/hooks/favicon.js +14 -0
- package/dist/hooks/fetch.d.ts +8 -0
- package/dist/hooks/fetch.js +29 -0
- package/dist/hooks/focustrap.d.ts +12 -0
- package/dist/hooks/focustrap.js +62 -0
- package/dist/hooks/focuswithin.d.ts +6 -0
- package/dist/hooks/focuswithin.js +24 -0
- package/dist/hooks/form.d.ts +20 -0
- package/dist/hooks/form.js +42 -0
- package/dist/hooks/fullscreen.d.ts +10 -0
- package/dist/hooks/fullscreen.js +34 -0
- package/dist/hooks/geolocation.d.ts +10 -0
- package/dist/hooks/geolocation.js +38 -0
- package/dist/hooks/hash.d.ts +3 -0
- package/dist/hooks/hash.js +21 -0
- package/dist/hooks/hotkeys.d.ts +11 -0
- package/dist/hooks/hotkeys.js +35 -0
- package/dist/hooks/hover.d.ts +3 -0
- package/dist/hooks/hover.js +22 -0
- package/dist/hooks/idle.d.ts +3 -0
- package/dist/hooks/idle.js +28 -0
- package/dist/hooks/infinitescroll.d.ts +9 -0
- package/dist/hooks/infinitescroll.js +31 -0
- package/dist/hooks/interval.d.ts +3 -0
- package/dist/hooks/interval.js +16 -0
- package/dist/hooks/inview.d.ts +10 -0
- package/dist/hooks/inview.js +28 -0
- package/dist/hooks/keyboard.d.ts +14 -0
- package/dist/hooks/keyboard.js +82 -0
- package/dist/hooks/keypress.d.ts +3 -0
- package/dist/hooks/keypress.js +23 -0
- package/dist/hooks/list.d.ts +14 -0
- package/dist/hooks/list.js +28 -0
- package/dist/hooks/longpress.d.ts +10 -0
- package/dist/hooks/longpress.js +24 -0
- package/dist/hooks/map.d.ts +12 -0
- package/dist/hooks/map.js +23 -0
- package/dist/hooks/measure.d.ts +16 -0
- package/dist/hooks/measure.js +34 -0
- package/dist/hooks/media.d.ts +33 -0
- package/dist/hooks/media.js +35 -0
- package/dist/hooks/mediarecorder.d.ts +11 -0
- package/dist/hooks/mediarecorder.js +37 -0
- package/dist/hooks/mounted.d.ts +3 -0
- package/dist/hooks/mounted.js +12 -0
- package/dist/hooks/mouseposition.d.ts +7 -0
- package/dist/hooks/mouseposition.js +16 -0
- package/dist/hooks/networkstate.d.ts +10 -0
- package/dist/hooks/networkstate.js +34 -0
- package/dist/hooks/online.d.ts +3 -0
- package/dist/hooks/online.js +20 -0
- package/dist/hooks/orientation.d.ts +8 -0
- package/dist/hooks/orientation.js +20 -0
- package/dist/hooks/os.d.ts +4 -0
- package/dist/hooks/os.js +15 -0
- package/dist/hooks/pageleave.d.ts +3 -0
- package/dist/hooks/pageleave.js +18 -0
- package/dist/hooks/pagination.d.ts +26 -0
- package/dist/hooks/pagination.js +49 -0
- package/dist/hooks/permission.d.ts +5 -0
- package/dist/hooks/permission.js +29 -0
- package/dist/hooks/preferredlanguage.d.ts +3 -0
- package/dist/hooks/preferredlanguage.js +17 -0
- package/dist/hooks/previous.d.ts +3 -0
- package/dist/hooks/previous.js +12 -0
- package/dist/hooks/queue.d.ts +11 -0
- package/dist/hooks/queue.js +23 -0
- package/dist/hooks/readprogress.d.ts +6 -0
- package/dist/hooks/readprogress.js +32 -0
- package/dist/hooks/resizeobserver.d.ts +10 -0
- package/dist/hooks/resizeobserver.js +25 -0
- package/dist/hooks/script.d.ts +4 -0
- package/dist/hooks/script.js +30 -0
- package/dist/hooks/scrolldirection.d.ts +4 -0
- package/dist/hooks/scrolldirection.js +33 -0
- package/dist/hooks/scrolllock.d.ts +3 -0
- package/dist/hooks/scrolllock.js +38 -0
- package/dist/hooks/scrollspy.d.ts +7 -0
- package/dist/hooks/scrollspy.js +28 -0
- package/dist/hooks/scrolltop.d.ts +7 -0
- package/dist/hooks/scrolltop.js +19 -0
- package/dist/hooks/selection.d.ts +12 -0
- package/dist/hooks/selection.js +32 -0
- package/dist/hooks/share.d.ts +13 -0
- package/dist/hooks/share.js +37 -0
- package/dist/hooks/speechrecognition.d.ts +10 -0
- package/dist/hooks/speechrecognition.js +34 -0
- package/dist/hooks/stepper.d.ts +13 -0
- package/dist/hooks/stepper.js +31 -0
- package/dist/hooks/storage.d.ts +5 -0
- package/dist/hooks/storage.js +57 -0
- package/dist/hooks/stylesheet.d.ts +4 -0
- package/dist/hooks/stylesheet.js +30 -0
- package/dist/hooks/textselection.d.ts +7 -0
- package/dist/hooks/textselection.js +24 -0
- package/dist/hooks/throttle.d.ts +3 -0
- package/dist/hooks/throttle.js +28 -0
- package/dist/hooks/toggle.d.ts +13 -0
- package/dist/hooks/toggle.js +10 -0
- package/dist/hooks/undoredo.d.ts +12 -0
- package/dist/hooks/undoredo.js +50 -0
- package/dist/hooks/vibrate.d.ts +7 -0
- package/dist/hooks/vibrate.js +15 -0
- package/dist/hooks/viewtransition.d.ts +9 -0
- package/dist/hooks/viewtransition.js +38 -0
- package/dist/hooks/wakelock.d.ts +9 -0
- package/dist/hooks/wakelock.js +32 -0
- package/dist/hooks/websocket.d.ts +10 -0
- package/dist/hooks/websocket.js +30 -0
- package/dist/hooks/windowsize.d.ts +7 -0
- package/dist/hooks/windowsize.js +17 -0
- package/dist/i18n.d.ts +30 -0
- package/dist/i18n.js +73 -0
- package/dist/index.d.ts +115 -0
- package/dist/index.js +107 -0
- package/dist/lastmodified.d.ts +4 -0
- package/dist/lastmodified.js +24 -0
- package/dist/linkcheck.d.ts +26 -0
- package/dist/linkcheck.js +113 -0
- package/dist/llms.d.ts +14 -0
- package/dist/llms.js +39 -0
- package/dist/manifest.d.ts +24 -0
- package/dist/manifest.js +31 -0
- package/dist/mcp.d.ts +56 -0
- package/dist/mcp.js +74 -0
- package/dist/mdtoc.d.ts +16 -0
- package/dist/mdtoc.js +59 -0
- package/dist/mdxscope.d.ts +17 -0
- package/dist/mdxscope.js +58 -0
- package/dist/meta.d.ts +19 -0
- package/dist/meta.js +71 -0
- package/dist/migrate.d.ts +17 -0
- package/dist/migrate.js +108 -0
- package/dist/navgen.d.ts +31 -0
- package/dist/navgen.js +147 -0
- package/dist/navtree.d.ts +28 -0
- package/dist/navtree.js +93 -0
- package/dist/next.d.ts +3 -0
- package/dist/next.js +3 -0
- package/dist/oembed.d.ts +20 -0
- package/dist/oembed.js +62 -0
- package/dist/ogimage.d.ts +45 -0
- package/dist/ogimage.js +62 -0
- package/dist/openapi.d.ts +6 -0
- package/dist/openapi.js +141 -0
- package/dist/openapiguard.d.ts +22 -0
- package/dist/openapiguard.js +87 -0
- package/dist/openapiutil.d.ts +72 -0
- package/dist/openapiutil.js +61 -0
- package/dist/orama.d.ts +16 -0
- package/dist/orama.js +100 -0
- package/dist/pipeline.d.ts +19 -0
- package/dist/pipeline.js +40 -0
- package/dist/preload.d.ts +15 -0
- package/dist/preload.js +19 -0
- package/dist/ranking.d.ts +28 -0
- package/dist/ranking.js +95 -0
- package/dist/reactrouter.d.ts +3 -0
- package/dist/reactrouter.js +3 -0
- package/dist/readtime.d.ts +3 -0
- package/dist/readtime.js +8 -0
- package/dist/redirects.d.ts +27 -0
- package/dist/redirects.js +74 -0
- package/dist/rehype.d.ts +5 -0
- package/dist/rehype.js +30 -0
- package/dist/rehypeautolink.d.ts +11 -0
- package/dist/rehypeautolink.js +43 -0
- package/dist/rehypecode.d.ts +6 -0
- package/dist/rehypecode.js +68 -0
- package/dist/rehypecopy.d.ts +6 -0
- package/dist/rehypecopy.js +29 -0
- package/dist/rehypeinline.d.ts +6 -0
- package/dist/rehypeinline.js +32 -0
- package/dist/rehypelinks.d.ts +10 -0
- package/dist/rehypelinks.js +49 -0
- package/dist/rehyperaw.d.ts +6 -0
- package/dist/rehyperaw.js +27 -0
- package/dist/rehypeslug.d.ts +7 -0
- package/dist/rehypeslug.js +39 -0
- package/dist/rehypetablewrap.d.ts +9 -0
- package/dist/rehypetablewrap.js +24 -0
- package/dist/rehypetoc.d.ts +16 -0
- package/dist/rehypetoc.js +61 -0
- package/dist/remark.d.ts +6 -0
- package/dist/remark.js +48 -0
- package/dist/remarkadmonition.d.ts +6 -0
- package/dist/remarkadmonition.js +78 -0
- package/dist/remarkannotation.d.ts +10 -0
- package/dist/remarkannotation.js +65 -0
- package/dist/remarkbadge.d.ts +6 -0
- package/dist/remarkbadge.js +40 -0
- package/dist/remarkblockmath.d.ts +6 -0
- package/dist/remarkblockmath.js +57 -0
- package/dist/remarkcallout.d.ts +6 -0
- package/dist/remarkcallout.js +65 -0
- package/dist/remarkcaption.d.ts +6 -0
- package/dist/remarkcaption.js +48 -0
- package/dist/remarkcodetitle.d.ts +6 -0
- package/dist/remarkcodetitle.js +39 -0
- package/dist/remarkcolumns.d.ts +6 -0
- package/dist/remarkcolumns.js +67 -0
- package/dist/remarkdetails.d.ts +6 -0
- package/dist/remarkdetails.js +61 -0
- package/dist/remarkdirective.d.ts +7 -0
- package/dist/remarkdirective.js +98 -0
- package/dist/remarkembed.d.ts +6 -0
- package/dist/remarkembed.js +72 -0
- package/dist/remarkfiletree.d.ts +6 -0
- package/dist/remarkfiletree.js +67 -0
- package/dist/remarkfootnote.d.ts +6 -0
- package/dist/remarkfootnote.js +63 -0
- package/dist/remarkgfm.d.ts +6 -0
- package/dist/remarkgfm.js +60 -0
- package/dist/remarkheadingid.d.ts +6 -0
- package/dist/remarkheadingid.js +40 -0
- package/dist/remarkimage.d.ts +11 -0
- package/dist/remarkimage.js +91 -0
- package/dist/remarkinclude.d.ts +10 -0
- package/dist/remarkinclude.js +49 -0
- package/dist/remarkinstall.d.ts +6 -0
- package/dist/remarkinstall.js +52 -0
- package/dist/remarklinkcard.d.ts +6 -0
- package/dist/remarklinkcard.js +38 -0
- package/dist/remarkmath.d.ts +6 -0
- package/dist/remarkmath.js +69 -0
- package/dist/remarkmermaid.d.ts +6 -0
- package/dist/remarkmermaid.js +21 -0
- package/dist/remarkmeta.d.ts +15 -0
- package/dist/remarkmeta.js +63 -0
- package/dist/remarkreadingtime.d.ts +11 -0
- package/dist/remarkreadingtime.js +44 -0
- package/dist/remarksteps.d.ts +6 -0
- package/dist/remarksteps.js +56 -0
- package/dist/remarkstructure.d.ts +18 -0
- package/dist/remarkstructure.js +53 -0
- package/dist/remarktabs.d.ts +6 -0
- package/dist/remarktabs.js +42 -0
- package/dist/remarktoc.d.ts +6 -0
- package/dist/remarktoc.js +47 -0
- package/dist/remarkts2js.d.ts +6 -0
- package/dist/remarkts2js.js +88 -0
- package/dist/remarktwoslash.d.ts +20 -0
- package/dist/remarktwoslash.js +86 -0
- package/dist/remarkvideo.d.ts +16 -0
- package/dist/remarkvideo.js +59 -0
- package/dist/remix.d.ts +3 -0
- package/dist/remix.js +3 -0
- package/dist/schema.d.ts +54 -0
- package/dist/schema.js +17 -0
- package/dist/search.d.ts +24 -0
- package/dist/search.js +155 -0
- package/dist/searchindex.d.ts +28 -0
- package/dist/searchindex.js +184 -0
- package/dist/searchpolicy.d.ts +5 -0
- package/dist/searchpolicy.js +9 -0
- package/dist/searchscore.d.ts +30 -0
- package/dist/searchscore.js +54 -0
- package/dist/searchtypo.d.ts +3 -0
- package/dist/searchtypo.js +47 -0
- package/dist/seo.d.ts +26 -0
- package/dist/seo.js +69 -0
- package/dist/shortcodes.d.ts +13 -0
- package/dist/shortcodes.js +61 -0
- package/dist/sitemap.d.ts +25 -0
- package/dist/sitemap.js +69 -0
- package/dist/snippets.d.ts +18 -0
- package/dist/snippets.js +89 -0
- package/dist/source.d.ts +23 -0
- package/dist/source.js +188 -0
- package/dist/stats.d.ts +25 -0
- package/dist/stats.js +81 -0
- package/dist/tanstack.d.ts +3 -0
- package/dist/tanstack.js +3 -0
- package/dist/testing.d.ts +35 -0
- package/dist/testing.js +134 -0
- package/dist/themeutil.d.ts +31 -0
- package/dist/themeutil.js +92 -0
- package/dist/typegen.d.ts +10 -0
- package/dist/typegen.js +74 -0
- package/dist/types.d.ts +267 -0
- package/dist/types.js +1 -0
- package/dist/validate.d.ts +13 -0
- package/dist/validate.js +78 -0
- package/dist/validator.d.ts +35 -0
- package/dist/validator.js +53 -0
- package/dist/versioning.d.ts +32 -0
- package/dist/versioning.js +62 -0
- package/dist/vite.d.ts +3 -0
- package/dist/vite.js +3 -0
- package/dist/watcher.d.ts +19 -0
- package/dist/watcher.js +82 -0
- package/dist/webhook.d.ts +25 -0
- package/dist/webhook.js +67 -0
- package/dist/workspace.d.ts +26 -0
- package/dist/workspace.js +81 -0
- package/package.json +138 -11
- package/styles/reset.css +3 -0
- package/index.js +0 -3
package/dist/source.js
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import matter from 'gray-matter';
|
|
2
|
+
import { z } from './schema';
|
|
3
|
+
|
|
4
|
+
function createRemoteSource(config) {
|
|
5
|
+
const base = trimslash(config.baseUrl);
|
|
6
|
+
const ttl = config.ttl ?? 1e3 * 60 * 5;
|
|
7
|
+
const indexUrl = config.index || `${base}/llms.txt`;
|
|
8
|
+
const docsUrl = config.docsEndpoint || `${base}/api/docs?limit=1000`;
|
|
9
|
+
const rawUrl = trimslash(config.rawEndpoint || `${base}/api/raw`);
|
|
10
|
+
const searchIndexUrl = config.searchIndexEndpoint || `${base}/api/search-index`;
|
|
11
|
+
const listcache = createcache(ttl);
|
|
12
|
+
const filecache = createcache(ttl);
|
|
13
|
+
const searchcache = createcache(ttl);
|
|
14
|
+
return {
|
|
15
|
+
async list() {
|
|
16
|
+
const cached = listcache.get("list");
|
|
17
|
+
if (cached) return cached;
|
|
18
|
+
const docs = await loaddocs(docsUrl);
|
|
19
|
+
if (docs.length > 0) {
|
|
20
|
+
listcache.set("list", docs);
|
|
21
|
+
return docs;
|
|
22
|
+
}
|
|
23
|
+
const llms = await loadllms(indexUrl, base);
|
|
24
|
+
listcache.set("list", llms);
|
|
25
|
+
return llms;
|
|
26
|
+
},
|
|
27
|
+
async get(slug) {
|
|
28
|
+
const path = slug.length === 0 ? "index" : slug.join("/");
|
|
29
|
+
const cached = filecache.get(path);
|
|
30
|
+
if (cached) return cached;
|
|
31
|
+
const normalized = slug.length === 0 ? "index" : slug.map((part) => encodeURIComponent(part)).join("/");
|
|
32
|
+
const res = await fetch(`${rawUrl}/${normalized}`);
|
|
33
|
+
if (!res.ok) return null;
|
|
34
|
+
const source = await res.text();
|
|
35
|
+
const parsed = parsefrontmatter(source);
|
|
36
|
+
const docs = await this.list();
|
|
37
|
+
const item = docs.find((doc) => doc.slug === path || path === "index" && doc.slug === "");
|
|
38
|
+
const data = { ...parsed.data };
|
|
39
|
+
if (item?.title) data.title = item.title;
|
|
40
|
+
if (item?.description) data.description = item.description;
|
|
41
|
+
const value = { content: parsed.content, data };
|
|
42
|
+
filecache.set(path, value);
|
|
43
|
+
return value;
|
|
44
|
+
},
|
|
45
|
+
async search() {
|
|
46
|
+
const cached = searchcache.get("search");
|
|
47
|
+
if (cached) return cached;
|
|
48
|
+
const docs = await loadsearch(searchIndexUrl);
|
|
49
|
+
searchcache.set("search", docs);
|
|
50
|
+
return docs;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function createcache(ttl) {
|
|
55
|
+
const store = /* @__PURE__ */ new Map();
|
|
56
|
+
return {
|
|
57
|
+
get(key) {
|
|
58
|
+
const value = store.get(key);
|
|
59
|
+
if (!value) return null;
|
|
60
|
+
if (Date.now() - value.at > ttl) {
|
|
61
|
+
store.delete(key);
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
return value.data;
|
|
65
|
+
},
|
|
66
|
+
set(key, data) {
|
|
67
|
+
store.set(key, { data, at: Date.now() });
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
const docsSchema = z.object({
|
|
72
|
+
data: z.array(
|
|
73
|
+
z.object({
|
|
74
|
+
slug: z.string(),
|
|
75
|
+
title: z.string(),
|
|
76
|
+
description: z.string().optional()
|
|
77
|
+
})
|
|
78
|
+
)
|
|
79
|
+
});
|
|
80
|
+
const indexSchema = z.object({
|
|
81
|
+
documents: z.array(
|
|
82
|
+
z.object({
|
|
83
|
+
path: z.string(),
|
|
84
|
+
title: z.string(),
|
|
85
|
+
description: z.string().optional(),
|
|
86
|
+
headings: z.array(z.string()),
|
|
87
|
+
content: z.string()
|
|
88
|
+
})
|
|
89
|
+
)
|
|
90
|
+
});
|
|
91
|
+
async function loaddocs(url) {
|
|
92
|
+
try {
|
|
93
|
+
const res = await fetch(url);
|
|
94
|
+
if (!res.ok) return [];
|
|
95
|
+
const data = docsSchema.parse(await res.json());
|
|
96
|
+
return data.data;
|
|
97
|
+
} catch {
|
|
98
|
+
return [];
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
async function loadsearch(url) {
|
|
102
|
+
try {
|
|
103
|
+
const res = await fetch(url);
|
|
104
|
+
if (!res.ok) return [];
|
|
105
|
+
const data = indexSchema.parse(await res.json());
|
|
106
|
+
return data.documents.map((doc) => ({
|
|
107
|
+
slug: normalizepath(doc.path),
|
|
108
|
+
title: doc.title,
|
|
109
|
+
description: doc.description,
|
|
110
|
+
content: doc.content,
|
|
111
|
+
headings: headings(doc.headings)
|
|
112
|
+
}));
|
|
113
|
+
} catch {
|
|
114
|
+
return [];
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
async function loadllms(url, base) {
|
|
118
|
+
try {
|
|
119
|
+
const res = await fetch(url);
|
|
120
|
+
if (!res.ok) return [];
|
|
121
|
+
const text = await res.text();
|
|
122
|
+
return parseLlmsIndex(text, base);
|
|
123
|
+
} catch {
|
|
124
|
+
return [];
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function parseLlmsIndex(text, baseUrl) {
|
|
128
|
+
const docs = [];
|
|
129
|
+
for (const line of text.split("\n")) {
|
|
130
|
+
const match = line.match(/^- \[(.+?)\]\((.+?)\)(?:: (.+))?$/);
|
|
131
|
+
if (!match) continue;
|
|
132
|
+
const title = match[1];
|
|
133
|
+
const url = match[2];
|
|
134
|
+
if (!title || !url) continue;
|
|
135
|
+
const description = match[3]?.trim();
|
|
136
|
+
const slug = slugfrom(url, baseUrl);
|
|
137
|
+
if (!slug && url !== `${baseUrl}/docs`) continue;
|
|
138
|
+
docs.push({ slug, title, description });
|
|
139
|
+
}
|
|
140
|
+
return docs;
|
|
141
|
+
}
|
|
142
|
+
function slugfrom(value, base) {
|
|
143
|
+
const parsed = parseurl(value, base);
|
|
144
|
+
if (!parsed) return "";
|
|
145
|
+
const path = parsed.pathname.replace(/^\/docs\/?/, "").replace(/\/$/, "").trim();
|
|
146
|
+
return normalizepath(path);
|
|
147
|
+
}
|
|
148
|
+
function parseurl(value, base) {
|
|
149
|
+
try {
|
|
150
|
+
return new URL(value, base);
|
|
151
|
+
} catch {
|
|
152
|
+
return null;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
function normalizepath(value) {
|
|
156
|
+
return value.replace(/^\/+/, "").replace(/\/+$/, "");
|
|
157
|
+
}
|
|
158
|
+
function trimslash(value) {
|
|
159
|
+
return value.replace(/\/+$/, "");
|
|
160
|
+
}
|
|
161
|
+
function headingid(text) {
|
|
162
|
+
return text.toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9_-]/g, "").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
163
|
+
}
|
|
164
|
+
function parsefrontmatter(source) {
|
|
165
|
+
try {
|
|
166
|
+
const parsed = matter(source);
|
|
167
|
+
const data = typeof parsed.data === "object" && parsed.data !== null ? { ...parsed.data } : {};
|
|
168
|
+
return { content: parsed.content, data };
|
|
169
|
+
} catch {
|
|
170
|
+
return { content: source, data: {} };
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
function headings(values) {
|
|
174
|
+
if (values.length === 0) return void 0;
|
|
175
|
+
const seen = /* @__PURE__ */ new Map();
|
|
176
|
+
const list = [];
|
|
177
|
+
for (const text of values) {
|
|
178
|
+
const base = headingid(text);
|
|
179
|
+
if (!base) continue;
|
|
180
|
+
const count = seen.get(base) ?? 0;
|
|
181
|
+
seen.set(base, count + 1);
|
|
182
|
+
const id = count === 0 ? base : `${base}-${count}`;
|
|
183
|
+
list.push({ id, text, level: 2 });
|
|
184
|
+
}
|
|
185
|
+
return list.length > 0 ? list : void 0;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export { createRemoteSource };
|
package/dist/stats.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
type DocsStats = {
|
|
2
|
+
totalPages: number;
|
|
3
|
+
totalWords: number;
|
|
4
|
+
avgWords: number;
|
|
5
|
+
totalHeadings: number;
|
|
6
|
+
totalLinks: number;
|
|
7
|
+
totalCodeBlocks: number;
|
|
8
|
+
totalImages: number;
|
|
9
|
+
languages: Record<string, number>;
|
|
10
|
+
lastUpdated: string;
|
|
11
|
+
};
|
|
12
|
+
type PageStats = {
|
|
13
|
+
path: string;
|
|
14
|
+
words: number;
|
|
15
|
+
headings: number;
|
|
16
|
+
links: number;
|
|
17
|
+
codeBlocks: number;
|
|
18
|
+
images: number;
|
|
19
|
+
};
|
|
20
|
+
declare function analyzePage(content: string, path: string): PageStats;
|
|
21
|
+
declare function analyzeDocs(dir: string): Promise<DocsStats>;
|
|
22
|
+
declare function formatStats(stats: DocsStats): string;
|
|
23
|
+
declare function compareStats(before: DocsStats, after: DocsStats): string;
|
|
24
|
+
|
|
25
|
+
export { type DocsStats, type PageStats, analyzeDocs, analyzePage, compareStats, formatStats };
|
package/dist/stats.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { readFile, stat, readdir } from 'node:fs/promises';
|
|
2
|
+
import { relative, join, extname } from 'node:path';
|
|
3
|
+
|
|
4
|
+
function analyzePage(content, path) {
|
|
5
|
+
const words = content.split(/\s+/).filter(Boolean).length;
|
|
6
|
+
const headings = (content.match(/^#{1,6}\s/gm) || []).length;
|
|
7
|
+
const links = (content.match(/\[([^\]]*)\]\(([^)]*)\)/g) || []).length;
|
|
8
|
+
const images = (content.match(/!\[([^\]]*)\]\(([^)]*)\)/g) || []).length;
|
|
9
|
+
const codeBlocks = Math.floor((content.match(/^```/gm) || []).length / 2);
|
|
10
|
+
return { path, words, headings, links, codeBlocks, images };
|
|
11
|
+
}
|
|
12
|
+
function extractLanguages(content) {
|
|
13
|
+
const langs = {};
|
|
14
|
+
for (const m of content.match(/^```(\w+)/gm) || []) {
|
|
15
|
+
const l = m.slice(3);
|
|
16
|
+
langs[l] = (langs[l] || 0) + 1;
|
|
17
|
+
}
|
|
18
|
+
return langs;
|
|
19
|
+
}
|
|
20
|
+
async function collectFiles(dir) {
|
|
21
|
+
const files = [];
|
|
22
|
+
for (const entry of await readdir(dir, { withFileTypes: true })) {
|
|
23
|
+
const full = join(dir, entry.name);
|
|
24
|
+
if (entry.isDirectory()) files.push(...await collectFiles(full));
|
|
25
|
+
else if ([".md", ".mdx"].includes(extname(entry.name))) files.push(full);
|
|
26
|
+
}
|
|
27
|
+
return files;
|
|
28
|
+
}
|
|
29
|
+
async function analyzeDocs(dir) {
|
|
30
|
+
const files = await collectFiles(dir);
|
|
31
|
+
const pages = [];
|
|
32
|
+
const languages = {};
|
|
33
|
+
let latest = "";
|
|
34
|
+
for (const file of files) {
|
|
35
|
+
const content = await readFile(file, "utf-8");
|
|
36
|
+
const modified = (await stat(file)).mtime.toISOString();
|
|
37
|
+
if (modified > latest) latest = modified;
|
|
38
|
+
pages.push(analyzePage(content, relative(dir, file)));
|
|
39
|
+
for (const [lang, count] of Object.entries(extractLanguages(content)))
|
|
40
|
+
languages[lang] = (languages[lang] || 0) + count;
|
|
41
|
+
}
|
|
42
|
+
const totalWords = pages.reduce((s, p) => s + p.words, 0);
|
|
43
|
+
const sum = (fn) => pages.reduce((s, p) => s + fn(p), 0);
|
|
44
|
+
return {
|
|
45
|
+
totalPages: pages.length,
|
|
46
|
+
totalWords,
|
|
47
|
+
avgWords: pages.length ? Math.round(totalWords / pages.length) : 0,
|
|
48
|
+
totalHeadings: sum((p) => p.headings),
|
|
49
|
+
totalLinks: sum((p) => p.links),
|
|
50
|
+
totalCodeBlocks: sum((p) => p.codeBlocks),
|
|
51
|
+
totalImages: sum((p) => p.images),
|
|
52
|
+
languages,
|
|
53
|
+
lastUpdated: latest || (/* @__PURE__ */ new Date()).toISOString()
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function formatStats(stats) {
|
|
57
|
+
const langs = Object.entries(stats.languages).sort((a, b) => b[1] - a[1]).map(([l, c]) => `${l}: ${c}`).join(", ");
|
|
58
|
+
return [
|
|
59
|
+
`pages: ${stats.totalPages}`,
|
|
60
|
+
`words: ${stats.totalWords} (avg ${stats.avgWords}/page)`,
|
|
61
|
+
`headings: ${stats.totalHeadings}`,
|
|
62
|
+
`links: ${stats.totalLinks}`,
|
|
63
|
+
`code blocks: ${stats.totalCodeBlocks}`,
|
|
64
|
+
`images: ${stats.totalImages}`,
|
|
65
|
+
langs ? `languages: ${langs}` : null,
|
|
66
|
+
`updated: ${stats.lastUpdated}`
|
|
67
|
+
].filter(Boolean).join("\n");
|
|
68
|
+
}
|
|
69
|
+
function compareStats(before, after) {
|
|
70
|
+
const d = (l, a, b) => b - a === 0 ? null : `${l}: ${b - a > 0 ? "+" : ""}${b - a}`;
|
|
71
|
+
return [
|
|
72
|
+
d("pages", before.totalPages, after.totalPages),
|
|
73
|
+
d("words", before.totalWords, after.totalWords),
|
|
74
|
+
d("headings", before.totalHeadings, after.totalHeadings),
|
|
75
|
+
d("links", before.totalLinks, after.totalLinks),
|
|
76
|
+
d("code blocks", before.totalCodeBlocks, after.totalCodeBlocks),
|
|
77
|
+
d("images", before.totalImages, after.totalImages)
|
|
78
|
+
].filter(Boolean).join("\n");
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export { analyzeDocs, analyzePage, compareStats, formatStats };
|
package/dist/tanstack.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
type TestCase = {
|
|
2
|
+
name: string;
|
|
3
|
+
fn: () => Promise<void> | void;
|
|
4
|
+
};
|
|
5
|
+
type TestResult = {
|
|
6
|
+
name: string;
|
|
7
|
+
passed: boolean;
|
|
8
|
+
error?: string;
|
|
9
|
+
duration: number;
|
|
10
|
+
};
|
|
11
|
+
type TestSuite = {
|
|
12
|
+
name: string;
|
|
13
|
+
results: TestResult[];
|
|
14
|
+
passed: number;
|
|
15
|
+
failed: number;
|
|
16
|
+
duration: number;
|
|
17
|
+
};
|
|
18
|
+
declare function createTestSuite(name: string): {
|
|
19
|
+
test: (caseName: string, fn: () => Promise<void> | void) => void;
|
|
20
|
+
run: () => Promise<TestSuite>;
|
|
21
|
+
};
|
|
22
|
+
declare function assertFrontmatter(content: string, fields: string[]): void;
|
|
23
|
+
declare function assertHeadings(content: string, options?: {
|
|
24
|
+
minCount?: number;
|
|
25
|
+
maxDepth?: number;
|
|
26
|
+
sequential?: boolean;
|
|
27
|
+
}): void;
|
|
28
|
+
declare function assertLinks(content: string): void;
|
|
29
|
+
declare function assertLength(content: string, options: {
|
|
30
|
+
minWords?: number;
|
|
31
|
+
maxWords?: number;
|
|
32
|
+
}): void;
|
|
33
|
+
declare function formatTestSuite(suite: TestSuite): string;
|
|
34
|
+
|
|
35
|
+
export { type TestCase, type TestResult, type TestSuite, assertFrontmatter, assertHeadings, assertLength, assertLinks, createTestSuite, formatTestSuite };
|
package/dist/testing.js
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
function headingid(value) {
|
|
2
|
+
return value.toLowerCase().replace(/[^\w\s-]/g, "").trim().replace(/\s+/g, "-");
|
|
3
|
+
}
|
|
4
|
+
function collectheadingids(content) {
|
|
5
|
+
return [...content.matchAll(/^#{1,6}\s+(.+)$/gm)].map((match) => {
|
|
6
|
+
const value = match[1];
|
|
7
|
+
if (!value) return "";
|
|
8
|
+
return headingid(value);
|
|
9
|
+
}).filter(Boolean);
|
|
10
|
+
}
|
|
11
|
+
function createTestSuite(name) {
|
|
12
|
+
const cases = [];
|
|
13
|
+
function test(caseName, fn) {
|
|
14
|
+
cases.push({ name: caseName, fn });
|
|
15
|
+
}
|
|
16
|
+
async function run() {
|
|
17
|
+
const results = [];
|
|
18
|
+
const start = performance.now();
|
|
19
|
+
for (const c of cases) {
|
|
20
|
+
const t = performance.now();
|
|
21
|
+
try {
|
|
22
|
+
await c.fn();
|
|
23
|
+
results.push({ name: c.name, passed: true, duration: performance.now() - t });
|
|
24
|
+
} catch (e) {
|
|
25
|
+
results.push({
|
|
26
|
+
name: c.name,
|
|
27
|
+
passed: false,
|
|
28
|
+
error: e instanceof Error ? e.message : String(e),
|
|
29
|
+
duration: performance.now() - t
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
name,
|
|
35
|
+
results,
|
|
36
|
+
passed: results.filter((r) => r.passed).length,
|
|
37
|
+
failed: results.filter((r) => !r.passed).length,
|
|
38
|
+
duration: performance.now() - start
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
return { test, run };
|
|
42
|
+
}
|
|
43
|
+
function assertFrontmatter(content, fields) {
|
|
44
|
+
const match = content.match(/^---\n([\s\S]*?)\n---/);
|
|
45
|
+
if (!match) throw new Error("missing frontmatter");
|
|
46
|
+
const body = match[1];
|
|
47
|
+
if (!body) throw new Error("invalid frontmatter");
|
|
48
|
+
const lines = body.split("\n");
|
|
49
|
+
const values = /* @__PURE__ */ new Map();
|
|
50
|
+
for (const line of lines) {
|
|
51
|
+
const index = line.indexOf(":");
|
|
52
|
+
if (index < 1) continue;
|
|
53
|
+
const key = line.slice(0, index).trim();
|
|
54
|
+
if (!key) continue;
|
|
55
|
+
if (values.has(key)) throw new Error(`duplicate field: ${key}`);
|
|
56
|
+
const value = line.slice(index + 1).trim();
|
|
57
|
+
values.set(key, value);
|
|
58
|
+
}
|
|
59
|
+
for (const field of fields) {
|
|
60
|
+
if (!values.has(field)) throw new Error(`missing field: ${field}`);
|
|
61
|
+
const value = values.get(field) ?? "";
|
|
62
|
+
if (!value) throw new Error(`empty field: ${field}`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function assertHeadings(content, options) {
|
|
66
|
+
const ids = collectheadingids(content);
|
|
67
|
+
const seen = /* @__PURE__ */ new Set();
|
|
68
|
+
for (const id of ids) {
|
|
69
|
+
if (seen.has(id)) throw new Error(`duplicate heading id: ${id}`);
|
|
70
|
+
seen.add(id);
|
|
71
|
+
}
|
|
72
|
+
const headings = [...content.matchAll(/^(#{1,6})\s+/gm)].map((m) => m[1]?.length ?? 0).filter((level) => level > 0);
|
|
73
|
+
if (options?.minCount && headings.length < options.minCount) {
|
|
74
|
+
throw new Error(`expected at least ${options.minCount} headings, found ${headings.length}`);
|
|
75
|
+
}
|
|
76
|
+
if (options?.maxDepth) {
|
|
77
|
+
for (const level of headings) {
|
|
78
|
+
if (level > options.maxDepth) {
|
|
79
|
+
throw new Error(`heading h${level} exceeds max depth ${options.maxDepth}`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (options?.sequential) {
|
|
84
|
+
for (let i = 1; i < headings.length; i++) {
|
|
85
|
+
const current = headings[i];
|
|
86
|
+
const previous = headings[i - 1];
|
|
87
|
+
if (!current || !previous) continue;
|
|
88
|
+
if (current > previous + 1) {
|
|
89
|
+
throw new Error(`heading h${headings[i]} skips level after h${headings[i - 1]}`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function assertLinks(content) {
|
|
95
|
+
const placeholders = /* @__PURE__ */ new Set(["#", "todo", "http://", "https://", "about:blank", "javascript:void(0)"]);
|
|
96
|
+
const headingids = new Set(collectheadingids(content));
|
|
97
|
+
const links = [...content.matchAll(/\[([^\]]*)\]\(([^)]*)\)/g)];
|
|
98
|
+
for (const [, text = "", url = ""] of links) {
|
|
99
|
+
if (!text.trim()) throw new Error("empty link text");
|
|
100
|
+
const value = url.trim();
|
|
101
|
+
const lowered = value.toLowerCase();
|
|
102
|
+
if (!value || placeholders.has(lowered)) {
|
|
103
|
+
throw new Error(`placeholder link: ${url}`);
|
|
104
|
+
}
|
|
105
|
+
if (value.startsWith("#")) {
|
|
106
|
+
const target = value.slice(1).toLowerCase();
|
|
107
|
+
if (!target || !headingids.has(target)) {
|
|
108
|
+
throw new Error(`missing anchor target: ${url}`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
function assertLength(content, options) {
|
|
114
|
+
const words = content.replace(/^---\n[\s\S]*?\n---\n?/, "").split(/\s+/).filter(Boolean).length;
|
|
115
|
+
if (options.minWords && words < options.minWords) {
|
|
116
|
+
throw new Error(`expected at least ${options.minWords} words, found ${words}`);
|
|
117
|
+
}
|
|
118
|
+
if (options.maxWords && words > options.maxWords) {
|
|
119
|
+
throw new Error(`expected at most ${options.maxWords} words, found ${words}`);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function formatTestSuite(suite) {
|
|
123
|
+
const lines = [
|
|
124
|
+
`${suite.name}: ${suite.passed}/${suite.results.length} passed (${Math.round(suite.duration)}ms)`
|
|
125
|
+
];
|
|
126
|
+
for (const r of suite.results) {
|
|
127
|
+
const status = r.passed ? "pass" : "FAIL";
|
|
128
|
+
lines.push(` ${status} ${r.name} (${Math.round(r.duration)}ms)`);
|
|
129
|
+
if (r.error) lines.push(` ${r.error}`);
|
|
130
|
+
}
|
|
131
|
+
return lines.join("\n");
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export { assertFrontmatter, assertHeadings, assertLength, assertLinks, createTestSuite, formatTestSuite };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
type ThemeColors = {
|
|
2
|
+
bg: string;
|
|
3
|
+
surface: string;
|
|
4
|
+
fg: string;
|
|
5
|
+
muted: string;
|
|
6
|
+
dim: string;
|
|
7
|
+
accent: string;
|
|
8
|
+
line: string;
|
|
9
|
+
success: string;
|
|
10
|
+
warning: string;
|
|
11
|
+
error: string;
|
|
12
|
+
info: string;
|
|
13
|
+
};
|
|
14
|
+
type ThemeConfig = {
|
|
15
|
+
light: ThemeColors;
|
|
16
|
+
dark: ThemeColors;
|
|
17
|
+
radius?: string;
|
|
18
|
+
font?: string;
|
|
19
|
+
mono?: string;
|
|
20
|
+
};
|
|
21
|
+
type ThemePreset = {
|
|
22
|
+
name: string;
|
|
23
|
+
config: ThemeConfig;
|
|
24
|
+
};
|
|
25
|
+
declare function generateCss(config: ThemeConfig): string;
|
|
26
|
+
declare const presets: Record<string, ThemePreset>;
|
|
27
|
+
declare function mergeTheme(base: ThemeConfig, overrides: Partial<ThemeConfig>): ThemeConfig;
|
|
28
|
+
declare function contrastRatio(hex1: string, hex2: string): number;
|
|
29
|
+
declare function cssVariables(colors: ThemeColors): Record<string, string>;
|
|
30
|
+
|
|
31
|
+
export { type ThemeColors, type ThemeConfig, type ThemePreset, contrastRatio, cssVariables, generateCss, mergeTheme, presets };
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
const colorKeys = [
|
|
2
|
+
"bg",
|
|
3
|
+
"surface",
|
|
4
|
+
"fg",
|
|
5
|
+
"muted",
|
|
6
|
+
"dim",
|
|
7
|
+
"accent",
|
|
8
|
+
"line",
|
|
9
|
+
"success",
|
|
10
|
+
"warning",
|
|
11
|
+
"error",
|
|
12
|
+
"info"
|
|
13
|
+
];
|
|
14
|
+
function colors(bg, surface, fg, muted, dim, accent, line, success, warning, error, info) {
|
|
15
|
+
return { bg, surface, fg, muted, dim, accent, line, success, warning, error, info };
|
|
16
|
+
}
|
|
17
|
+
function generateCss(config) {
|
|
18
|
+
const lines = [":root {"];
|
|
19
|
+
for (const key of colorKeys) lines.push(` --${key}: ${config.light[key]};`);
|
|
20
|
+
if (config.radius) lines.push(` --radius: ${config.radius};`);
|
|
21
|
+
if (config.font) lines.push(` --font: ${config.font};`);
|
|
22
|
+
if (config.mono) lines.push(` --mono: ${config.mono};`);
|
|
23
|
+
lines.push("}", "", ".dark {");
|
|
24
|
+
for (const key of colorKeys) lines.push(` --${key}: ${config.dark[key]};`);
|
|
25
|
+
lines.push("}");
|
|
26
|
+
return lines.join("\n");
|
|
27
|
+
}
|
|
28
|
+
const presets = {
|
|
29
|
+
default: {
|
|
30
|
+
name: "default",
|
|
31
|
+
config: {
|
|
32
|
+
light: colors("#ffffff", "#f8f9fa", "#1a1a1a", "#6b7280", "#9ca3af", "#2563eb", "#e5e7eb", "#16a34a", "#ca8a04", "#dc2626", "#2563eb"),
|
|
33
|
+
dark: colors("#0a0a0a", "#141414", "#f5f5f5", "#a1a1aa", "#71717a", "#3b82f6", "#27272a", "#22c55e", "#eab308", "#ef4444", "#3b82f6")
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
ocean: {
|
|
37
|
+
name: "ocean",
|
|
38
|
+
config: {
|
|
39
|
+
light: colors("#f0f7ff", "#e0efff", "#0c1929", "#4a6a8a", "#7a9aba", "#0066cc", "#c4daf0", "#0d7a3e", "#b8860b", "#c41e3a", "#0066cc"),
|
|
40
|
+
dark: colors("#0a1628", "#112240", "#e6f0ff", "#8baac8", "#5a7a98", "#4d9fff", "#1e3a5f", "#2ecc71", "#f1c40f", "#e74c3c", "#4d9fff")
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
forest: {
|
|
44
|
+
name: "forest",
|
|
45
|
+
config: {
|
|
46
|
+
light: colors("#f5faf5", "#e8f5e8", "#1a2e1a", "#4a6b4a", "#7a9b7a", "#2d8a4e", "#c8e0c8", "#1a7a35", "#a68b00", "#c0392b", "#2d8a4e"),
|
|
47
|
+
dark: colors("#0a160a", "#142014", "#e8f5e8", "#8ab88a", "#5a8a5a", "#4caf50", "#1e3a1e", "#27ae60", "#f39c12", "#e74c3c", "#4caf50")
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
rose: {
|
|
51
|
+
name: "rose",
|
|
52
|
+
config: {
|
|
53
|
+
light: colors("#fff5f7", "#ffe4ea", "#2a1015", "#8a4a5a", "#ba7a8a", "#e11d48", "#f0c8d0", "#16a34a", "#ca8a04", "#dc2626", "#e11d48"),
|
|
54
|
+
dark: colors("#160a0e", "#201418", "#fce4ec", "#c88a9a", "#8a5a6a", "#fb7185", "#3a1e28", "#22c55e", "#eab308", "#ef4444", "#fb7185")
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
function mergeTheme(base, overrides) {
|
|
59
|
+
return {
|
|
60
|
+
light: { ...base.light, ...overrides.light },
|
|
61
|
+
dark: { ...base.dark, ...overrides.dark },
|
|
62
|
+
radius: overrides.radius ?? base.radius,
|
|
63
|
+
font: overrides.font ?? base.font,
|
|
64
|
+
mono: overrides.mono ?? base.mono
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function luminance(hex) {
|
|
68
|
+
const rgb = [1, 3, 5].map((i) => {
|
|
69
|
+
const c = Number.parseInt(hex.slice(i, i + 2), 16) / 255;
|
|
70
|
+
return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
|
|
71
|
+
});
|
|
72
|
+
const red = rgb[0] ?? 0;
|
|
73
|
+
const green = rgb[1] ?? 0;
|
|
74
|
+
const blue = rgb[2] ?? 0;
|
|
75
|
+
return 0.2126 * red + 0.7152 * green + 0.0722 * blue;
|
|
76
|
+
}
|
|
77
|
+
function contrastRatio(hex1, hex2) {
|
|
78
|
+
const l1 = luminance(hex1);
|
|
79
|
+
const l2 = luminance(hex2);
|
|
80
|
+
const lighter = Math.max(l1, l2);
|
|
81
|
+
const darker = Math.min(l1, l2);
|
|
82
|
+
return (lighter + 0.05) / (darker + 0.05);
|
|
83
|
+
}
|
|
84
|
+
function cssVariables(colors2) {
|
|
85
|
+
const vars = {};
|
|
86
|
+
for (const key of colorKeys) {
|
|
87
|
+
vars[`--${key}`] = colors2[key];
|
|
88
|
+
}
|
|
89
|
+
return vars;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export { contrastRatio, cssVariables, generateCss, mergeTheme, presets };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface TypegenConfig {
|
|
2
|
+
dir: string;
|
|
3
|
+
output: string;
|
|
4
|
+
schemaName?: string;
|
|
5
|
+
}
|
|
6
|
+
declare function inferType(value: unknown): string;
|
|
7
|
+
declare function generateTypes(config: TypegenConfig): Promise<string>;
|
|
8
|
+
declare function writeTypes(config: TypegenConfig): Promise<void>;
|
|
9
|
+
|
|
10
|
+
export { type TypegenConfig, generateTypes, inferType, writeTypes };
|
package/dist/typegen.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { readFile, writeFile, readdir } from 'node:fs/promises';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import matter from 'gray-matter';
|
|
4
|
+
|
|
5
|
+
function inferType(value) {
|
|
6
|
+
if (value === null || value === void 0) return "unknown";
|
|
7
|
+
if (typeof value === "string") return "string";
|
|
8
|
+
if (typeof value === "number") return "number";
|
|
9
|
+
if (typeof value === "boolean") return "boolean";
|
|
10
|
+
if (Array.isArray(value)) {
|
|
11
|
+
if (value.length === 0) return "unknown[]";
|
|
12
|
+
const types = [...new Set(value.map(inferType))];
|
|
13
|
+
return types.length === 1 ? `${types[0]}[]` : `(${types.join(" | ")})[]`;
|
|
14
|
+
}
|
|
15
|
+
if (typeof value === "object") {
|
|
16
|
+
const entries = Object.entries(value);
|
|
17
|
+
if (entries.length === 0) return "Record<string, unknown>";
|
|
18
|
+
const fields = entries.map(([k, v]) => `${k}: ${inferType(v)}`).join("; ");
|
|
19
|
+
return `{ ${fields} }`;
|
|
20
|
+
}
|
|
21
|
+
return "unknown";
|
|
22
|
+
}
|
|
23
|
+
async function scanFiles(dir) {
|
|
24
|
+
const paths = [];
|
|
25
|
+
async function walk(current) {
|
|
26
|
+
const entries = await readdir(current, { withFileTypes: true });
|
|
27
|
+
for (const entry of entries) {
|
|
28
|
+
const full = join(current, entry.name);
|
|
29
|
+
if (entry.isDirectory()) await walk(full);
|
|
30
|
+
else if (entry.name.endsWith(".mdx")) paths.push(full);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
await walk(dir);
|
|
34
|
+
return paths;
|
|
35
|
+
}
|
|
36
|
+
async function generateTypes(config) {
|
|
37
|
+
const name = config.schemaName ?? "DocFrontmatter";
|
|
38
|
+
const files = await scanFiles(config.dir);
|
|
39
|
+
const fieldTypes = /* @__PURE__ */ new Map();
|
|
40
|
+
const fieldCounts = /* @__PURE__ */ new Map();
|
|
41
|
+
let total = 0;
|
|
42
|
+
for (const file of files) {
|
|
43
|
+
const source = await readFile(file, "utf-8");
|
|
44
|
+
const { data } = matter(source);
|
|
45
|
+
if (!data || typeof data !== "object") continue;
|
|
46
|
+
total++;
|
|
47
|
+
for (const [key, value] of Object.entries(data)) {
|
|
48
|
+
const type = inferType(value);
|
|
49
|
+
let field = fieldTypes.get(key);
|
|
50
|
+
if (!field) {
|
|
51
|
+
field = /* @__PURE__ */ new Set();
|
|
52
|
+
fieldTypes.set(key, field);
|
|
53
|
+
}
|
|
54
|
+
field.add(type);
|
|
55
|
+
fieldCounts.set(key, (fieldCounts.get(key) ?? 0) + 1);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const lines = [`export interface ${name} {`];
|
|
59
|
+
const sorted = [...fieldTypes.entries()].sort(([a], [b]) => a.localeCompare(b));
|
|
60
|
+
for (const [key, types] of sorted) {
|
|
61
|
+
const optional = (fieldCounts.get(key) ?? 0) < total;
|
|
62
|
+
const union = [...types].join(" | ");
|
|
63
|
+
const suffix = optional ? "?" : "";
|
|
64
|
+
lines.push(` ${key}${suffix}: ${union}`);
|
|
65
|
+
}
|
|
66
|
+
lines.push("}");
|
|
67
|
+
return lines.join("\n") + "\n";
|
|
68
|
+
}
|
|
69
|
+
async function writeTypes(config) {
|
|
70
|
+
const content = await generateTypes(config);
|
|
71
|
+
await writeFile(config.output, content, "utf-8");
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export { generateTypes, inferType, writeTypes };
|