@treeseed/core 0.1.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 +145 -0
- package/dist/agents/index.js +5 -0
- package/dist/agents/registry-helper.js +14 -0
- package/dist/agents/registry.js +88 -0
- package/dist/components/DevWatchReload.astro +45 -0
- package/dist/components/SiteTitle.astro +51 -0
- package/dist/components/content/ContentStatusLegend.astro +18 -0
- package/dist/components/content/StatusBadge.astro +11 -0
- package/dist/components/docs/BookFontControls.astro +180 -0
- package/dist/components/docs/DesktopSidebarToggle.astro +88 -0
- package/dist/components/docs/DownloadBook.astro +34 -0
- package/dist/components/docs/Footer.astro +196 -0
- package/dist/components/docs/Header.astro +150 -0
- package/dist/components/docs/PageFrame.astro +260 -0
- package/dist/components/docs/PageSidebar.astro +63 -0
- package/dist/components/docs/PageTitle.astro +39 -0
- package/dist/components/docs/Sidebar.astro +41 -0
- package/dist/components/docs/ThemeSelect.astro +3 -0
- package/dist/components/forms/ContactForm.astro +234 -0
- package/dist/components/forms/FooterSubscribeForm.astro +189 -0
- package/dist/components/site/BookList.astro +27 -0
- package/dist/components/site/CTASection.astro +24 -0
- package/dist/components/site/ChronicleList.astro +33 -0
- package/dist/components/site/Hero.astro +18 -0
- package/dist/components/site/NotesList.astro +18 -0
- package/dist/components/site/PathCard.astro +16 -0
- package/dist/components/site/ProfileList.astro +30 -0
- package/dist/components/site/SectionIntro.astro +9 -0
- package/dist/components/site/StageBanner.astro +8 -0
- package/dist/components/site/TrustCallout.astro +9 -0
- package/dist/components/starlight.js +6 -0
- package/dist/config.js +8 -0
- package/dist/content-config.js +9 -0
- package/dist/content.js +230 -0
- package/dist/contracts.d.ts +130 -0
- package/dist/contracts.js +0 -0
- package/dist/deploy/config.d.ts +4 -0
- package/dist/deploy/config.js +154 -0
- package/dist/deploy/runtime.js +77 -0
- package/dist/env.yaml +322 -0
- package/dist/environment.d.ts +130 -0
- package/dist/environment.js +324 -0
- package/dist/index.js +81 -0
- package/dist/layouts/AuthoredEntryLayout.astro +87 -0
- package/dist/layouts/BookLayout.astro +35 -0
- package/dist/layouts/BridgeLayout.astro +11 -0
- package/dist/layouts/ContentLayout.astro +24 -0
- package/dist/layouts/MainLayout.astro +203 -0
- package/dist/layouts/NoteLayout.astro +26 -0
- package/dist/layouts/ProfileLayout.astro +81 -0
- package/dist/middleware/starlightRouteData.js +45 -0
- package/dist/pages/404.astro +29 -0
- package/dist/pages/[slug].astro +30 -0
- package/dist/pages/agents/[slug].astro +29 -0
- package/dist/pages/agents/index.astro +27 -0
- package/dist/pages/api/form/submit.js +14 -0
- package/dist/pages/books/[slug].astro +19 -0
- package/dist/pages/books/index.astro +28 -0
- package/dist/pages/contact.astro +27 -0
- package/dist/pages/feed.xml.js +34 -0
- package/dist/pages/index.astro +290 -0
- package/dist/pages/notes/[slug].astro +19 -0
- package/dist/pages/notes/index.astro +21 -0
- package/dist/pages/objectives/[slug].astro +31 -0
- package/dist/pages/objectives/index.astro +30 -0
- package/dist/pages/people/[slug].astro +29 -0
- package/dist/pages/people/index.astro +28 -0
- package/dist/pages/questions/[slug].astro +31 -0
- package/dist/pages/questions/index.astro +30 -0
- package/dist/plugin-default.js +4 -0
- package/dist/plugins/builtin/default-plugin.d.ts +21 -0
- package/dist/plugins/builtin/default-plugin.js +32 -0
- package/dist/plugins/constants.d.ts +21 -0
- package/dist/plugins/constants.js +28 -0
- package/dist/plugins/plugin.d.ts +42 -0
- package/dist/plugins/plugin.js +6 -0
- package/dist/plugins/runtime.d.ts +31 -0
- package/dist/plugins/runtime.js +120 -0
- package/dist/scripts/aggregate-book.js +112 -0
- package/dist/scripts/assert-release-tag-version.js +21 -0
- package/dist/scripts/build-dist.js +384 -0
- package/dist/scripts/build-tenant-worker.js +36 -0
- package/dist/scripts/package-tools.js +88 -0
- package/dist/scripts/patch-starlight-content-path.js +172 -0
- package/dist/scripts/paths.js +11 -0
- package/dist/scripts/publish-package.js +20 -0
- package/dist/scripts/release-verify.js +52 -0
- package/dist/scripts/run-fixture-astro-command.js +21 -0
- package/dist/scripts/tenant-astro-command.js +3 -0
- package/dist/scripts/tenant-build.js +16 -0
- package/dist/scripts/tenant-check.js +7 -0
- package/dist/scripts/test-smoke.js +105 -0
- package/dist/server.js +53 -0
- package/dist/site-resources.d.ts +29 -0
- package/dist/site-resources.js +127 -0
- package/dist/site.js +313 -0
- package/dist/styles/global.css +683 -0
- package/dist/styles/prose.css +89 -0
- package/dist/styles/tokens.css +24 -0
- package/dist/tenant/bridge.js +5 -0
- package/dist/tenant/config.d.ts +9 -0
- package/dist/tenant/config.js +124 -0
- package/dist/tenant/runtime-config.js +20 -0
- package/dist/tsconfigs/strict.json +3 -0
- package/dist/types/agents.d.ts +1 -0
- package/dist/types/agents.js +1 -0
- package/dist/types/astro-build.d.js +0 -0
- package/dist/types/cloudflare-sockets.d.js +0 -0
- package/dist/types/cloudflare.d.ts +1 -0
- package/dist/types/cloudflare.js +1 -0
- package/dist/types/forms.js +4 -0
- package/dist/utils/agents/adapters/execution.js +90 -0
- package/dist/utils/agents/adapters/mutations.js +30 -0
- package/dist/utils/agents/adapters/notification.js +16 -0
- package/dist/utils/agents/adapters/repository.js +61 -0
- package/dist/utils/agents/adapters/research.js +25 -0
- package/dist/utils/agents/adapters/verification.js +62 -0
- package/dist/utils/agents/cli-tools.js +5 -0
- package/dist/utils/agents/contracts/messages.d.ts +88 -0
- package/dist/utils/agents/contracts/messages.js +138 -0
- package/dist/utils/agents/contracts/run.d.ts +20 -0
- package/dist/utils/agents/contracts/run.js +0 -0
- package/dist/utils/agents/runtime-types.d.ts +117 -0
- package/dist/utils/agents/runtime-types.js +4 -0
- package/dist/utils/books-data.js +82 -0
- package/dist/utils/content-status.js +38 -0
- package/dist/utils/forms/config.js +87 -0
- package/dist/utils/forms/constants.js +27 -0
- package/dist/utils/forms/contact-submissions-local.js +19 -0
- package/dist/utils/forms/contact-submissions.js +72 -0
- package/dist/utils/forms/crypto.js +64 -0
- package/dist/utils/forms/guard.js +76 -0
- package/dist/utils/forms/http.js +51 -0
- package/dist/utils/forms/provider-core.js +88 -0
- package/dist/utils/forms/routing-core.js +7 -0
- package/dist/utils/forms/routing.js +13 -0
- package/dist/utils/forms/runtime-core.js +17 -0
- package/dist/utils/forms/runtime.js +27 -0
- package/dist/utils/forms/service-core.js +256 -0
- package/dist/utils/forms/service.js +55 -0
- package/dist/utils/forms/session.js +57 -0
- package/dist/utils/forms/smtp-cloudflare.js +107 -0
- package/dist/utils/forms/smtp-node.js +27 -0
- package/dist/utils/forms/smtp.js +10 -0
- package/dist/utils/forms/subscribers-local.js +21 -0
- package/dist/utils/forms/subscribers.js +53 -0
- package/dist/utils/forms/turnstile.js +31 -0
- package/dist/utils/forms/validation.js +58 -0
- package/dist/utils/hub-content.js +28 -0
- package/dist/utils/plugin-runtime.js +158 -0
- package/dist/utils/routes.js +17 -0
- package/dist/utils/seo.js +4 -0
- package/dist/utils/site-config-schema.js +282 -0
- package/dist/utils/site-config.js +122 -0
- package/dist/utils/starlight-nav.js +62 -0
- package/dist/utils/theme.js +49 -0
- package/dist/vendor/starlight/components/AnchorHeading.astro +53 -0
- package/dist/vendor/starlight/components/Banner.astro +23 -0
- package/dist/vendor/starlight/components/ContentNotice.astro +33 -0
- package/dist/vendor/starlight/components/ContentPanel.astro +27 -0
- package/dist/vendor/starlight/components/DraftContentNotice.astro +5 -0
- package/dist/vendor/starlight/components/EditLink.astro +28 -0
- package/dist/vendor/starlight/components/FallbackContentNotice.astro +5 -0
- package/dist/vendor/starlight/components/Footer.astro +61 -0
- package/dist/vendor/starlight/components/Head.astro +5 -0
- package/dist/vendor/starlight/components/Header.astro +94 -0
- package/dist/vendor/starlight/components/Hero.astro +143 -0
- package/dist/vendor/starlight/components/Icons.js +121 -0
- package/dist/vendor/starlight/components/LanguageSelect.astro +57 -0
- package/dist/vendor/starlight/components/LastUpdated.astro +14 -0
- package/dist/vendor/starlight/components/MarkdownContent.astro +5 -0
- package/dist/vendor/starlight/components/MobileMenuFooter.astro +35 -0
- package/dist/vendor/starlight/components/MobileMenuToggle.astro +107 -0
- package/dist/vendor/starlight/components/MobileTableOfContents.astro +151 -0
- package/dist/vendor/starlight/components/Page.astro +126 -0
- package/dist/vendor/starlight/components/PageFrame.astro +97 -0
- package/dist/vendor/starlight/components/PageSidebar.astro +59 -0
- package/dist/vendor/starlight/components/PageTitle.astro +17 -0
- package/dist/vendor/starlight/components/Pagination.astro +79 -0
- package/dist/vendor/starlight/components/Search.astro +488 -0
- package/dist/vendor/starlight/components/Select.astro +99 -0
- package/dist/vendor/starlight/components/Sidebar.astro +15 -0
- package/dist/vendor/starlight/components/SidebarPersistState.js +43 -0
- package/dist/vendor/starlight/components/SidebarPersister.astro +78 -0
- package/dist/vendor/starlight/components/SidebarRestorePoint.astro +12 -0
- package/dist/vendor/starlight/components/SidebarSublist.astro +154 -0
- package/dist/vendor/starlight/components/SiteTitle.astro +59 -0
- package/dist/vendor/starlight/components/SkipLink.astro +26 -0
- package/dist/vendor/starlight/components/SocialIcons.astro +32 -0
- package/dist/vendor/starlight/components/StarlightPage.astro +17 -0
- package/dist/vendor/starlight/components/TableOfContents/TableOfContentsList.astro +79 -0
- package/dist/vendor/starlight/components/TableOfContents/starlight-toc.js +93 -0
- package/dist/vendor/starlight/components/TableOfContents.astro +18 -0
- package/dist/vendor/starlight/components/ThemeProvider.astro +38 -0
- package/dist/vendor/starlight/components/ThemeSelect.astro +73 -0
- package/dist/vendor/starlight/components/TwoColumnContent.astro +54 -0
- package/dist/vendor/starlight/components.js +26 -0
- package/dist/vendor/starlight/constants.js +4 -0
- package/dist/vendor/starlight/expressive-code.d.js +1 -0
- package/dist/vendor/starlight/global.d.js +0 -0
- package/dist/vendor/starlight/i18n.d.js +1 -0
- package/dist/vendor/starlight/index.js +119 -0
- package/dist/vendor/starlight/integrations/asides-error.js +12 -0
- package/dist/vendor/starlight/integrations/asides.js +179 -0
- package/dist/vendor/starlight/integrations/code-rtl-support.js +21 -0
- package/dist/vendor/starlight/integrations/expressive-code/hast.d.js +1 -0
- package/dist/vendor/starlight/integrations/expressive-code/index.js +63 -0
- package/dist/vendor/starlight/integrations/expressive-code/preprocessor.js +92 -0
- package/dist/vendor/starlight/integrations/expressive-code/themes/night-owl-dark.jsonc +1796 -0
- package/dist/vendor/starlight/integrations/expressive-code/themes/night-owl-dark.jsonc.js +1 -0
- package/dist/vendor/starlight/integrations/expressive-code/themes/night-owl-light.jsonc +1695 -0
- package/dist/vendor/starlight/integrations/expressive-code/themes/night-owl-light.jsonc.js +1 -0
- package/dist/vendor/starlight/integrations/expressive-code/theming.js +62 -0
- package/dist/vendor/starlight/integrations/expressive-code/translations.js +29 -0
- package/dist/vendor/starlight/integrations/heading-links.js +61 -0
- package/dist/vendor/starlight/integrations/pagefind.js +43 -0
- package/dist/vendor/starlight/integrations/remark-rehype.js +68 -0
- package/dist/vendor/starlight/integrations/shared/absolutePathToLang.js +15 -0
- package/dist/vendor/starlight/integrations/shared/localeToLang.js +9 -0
- package/dist/vendor/starlight/integrations/shared/slugToLocale.js +10 -0
- package/dist/vendor/starlight/integrations/sitemap.js +20 -0
- package/dist/vendor/starlight/integrations/virtual-user-config.js +110 -0
- package/dist/vendor/starlight/integrations/vite-layer-order.js +42 -0
- package/dist/vendor/starlight/internal.js +6 -0
- package/dist/vendor/starlight/loaders.js +36 -0
- package/dist/vendor/starlight/locals.d.js +0 -0
- package/dist/vendor/starlight/locals.js +30 -0
- package/dist/vendor/starlight/package.json +231 -0
- package/dist/vendor/starlight/package.json.js +248 -0
- package/dist/vendor/starlight/props.js +0 -0
- package/dist/vendor/starlight/route-data.js +6 -0
- package/dist/vendor/starlight/routes/common.astro +23 -0
- package/dist/vendor/starlight/routes/ssr/404.astro +7 -0
- package/dist/vendor/starlight/routes/ssr/index.astro +14 -0
- package/dist/vendor/starlight/routes/static/404.astro +7 -0
- package/dist/vendor/starlight/routes/static/index.astro +12 -0
- package/dist/vendor/starlight/schema.js +102 -0
- package/dist/vendor/starlight/schemas/badge.js +26 -0
- package/dist/vendor/starlight/schemas/components.js +235 -0
- package/dist/vendor/starlight/schemas/expressiveCode.js +12 -0
- package/dist/vendor/starlight/schemas/favicon.js +33 -0
- package/dist/vendor/starlight/schemas/head.js +32 -0
- package/dist/vendor/starlight/schemas/hero.js +57 -0
- package/dist/vendor/starlight/schemas/i18n.js +101 -0
- package/dist/vendor/starlight/schemas/icon.js +7 -0
- package/dist/vendor/starlight/schemas/logo.js +24 -0
- package/dist/vendor/starlight/schemas/pagefind.js +108 -0
- package/dist/vendor/starlight/schemas/prevNextLink.js +14 -0
- package/dist/vendor/starlight/schemas/sidebar.js +80 -0
- package/dist/vendor/starlight/schemas/site-title.js +19 -0
- package/dist/vendor/starlight/schemas/social.js +19 -0
- package/dist/vendor/starlight/schemas/tableOfContents.js +16 -0
- package/dist/vendor/starlight/style/anchor-links.css +131 -0
- package/dist/vendor/starlight/style/asides.css +51 -0
- package/dist/vendor/starlight/style/layers.css +1 -0
- package/dist/vendor/starlight/style/markdown.css +253 -0
- package/dist/vendor/starlight/style/print.css +175 -0
- package/dist/vendor/starlight/style/props.css +188 -0
- package/dist/vendor/starlight/style/reset.css +52 -0
- package/dist/vendor/starlight/style/util.css +63 -0
- package/dist/vendor/starlight/translations/ar.json +30 -0
- package/dist/vendor/starlight/translations/ar.json.js +32 -0
- package/dist/vendor/starlight/translations/ca.json +43 -0
- package/dist/vendor/starlight/translations/ca.json.js +45 -0
- package/dist/vendor/starlight/translations/cs.json +43 -0
- package/dist/vendor/starlight/translations/cs.json.js +45 -0
- package/dist/vendor/starlight/translations/da.json +30 -0
- package/dist/vendor/starlight/translations/da.json.js +32 -0
- package/dist/vendor/starlight/translations/de.json +30 -0
- package/dist/vendor/starlight/translations/de.json.js +32 -0
- package/dist/vendor/starlight/translations/el.json +30 -0
- package/dist/vendor/starlight/translations/el.json.js +32 -0
- package/dist/vendor/starlight/translations/en.json +30 -0
- package/dist/vendor/starlight/translations/en.json.js +32 -0
- package/dist/vendor/starlight/translations/es.json +43 -0
- package/dist/vendor/starlight/translations/es.json.js +45 -0
- package/dist/vendor/starlight/translations/fa.json +30 -0
- package/dist/vendor/starlight/translations/fa.json.js +32 -0
- package/dist/vendor/starlight/translations/fi.json +30 -0
- package/dist/vendor/starlight/translations/fi.json.js +32 -0
- package/dist/vendor/starlight/translations/fr.json +33 -0
- package/dist/vendor/starlight/translations/fr.json.js +35 -0
- package/dist/vendor/starlight/translations/gl.json +43 -0
- package/dist/vendor/starlight/translations/gl.json.js +45 -0
- package/dist/vendor/starlight/translations/he.json +30 -0
- package/dist/vendor/starlight/translations/he.json.js +32 -0
- package/dist/vendor/starlight/translations/hi.json +30 -0
- package/dist/vendor/starlight/translations/hi.json.js +32 -0
- package/dist/vendor/starlight/translations/hu.json +43 -0
- package/dist/vendor/starlight/translations/hu.json.js +45 -0
- package/dist/vendor/starlight/translations/id.json +30 -0
- package/dist/vendor/starlight/translations/id.json.js +32 -0
- package/dist/vendor/starlight/translations/index.js +77 -0
- package/dist/vendor/starlight/translations/it.json +30 -0
- package/dist/vendor/starlight/translations/it.json.js +32 -0
- package/dist/vendor/starlight/translations/ja.json +30 -0
- package/dist/vendor/starlight/translations/ja.json.js +32 -0
- package/dist/vendor/starlight/translations/ko.json +30 -0
- package/dist/vendor/starlight/translations/ko.json.js +32 -0
- package/dist/vendor/starlight/translations/lv.json +30 -0
- package/dist/vendor/starlight/translations/lv.json.js +32 -0
- package/dist/vendor/starlight/translations/nb.json +30 -0
- package/dist/vendor/starlight/translations/nb.json.js +32 -0
- package/dist/vendor/starlight/translations/nl.json +30 -0
- package/dist/vendor/starlight/translations/nl.json.js +32 -0
- package/dist/vendor/starlight/translations/pl.json +33 -0
- package/dist/vendor/starlight/translations/pl.json.js +35 -0
- package/dist/vendor/starlight/translations/pt.json +30 -0
- package/dist/vendor/starlight/translations/pt.json.js +32 -0
- package/dist/vendor/starlight/translations/ro.json +30 -0
- package/dist/vendor/starlight/translations/ro.json.js +32 -0
- package/dist/vendor/starlight/translations/ru.json +33 -0
- package/dist/vendor/starlight/translations/ru.json.js +35 -0
- package/dist/vendor/starlight/translations/sk.json +30 -0
- package/dist/vendor/starlight/translations/sk.json.js +32 -0
- package/dist/vendor/starlight/translations/sv.json +30 -0
- package/dist/vendor/starlight/translations/sv.json.js +32 -0
- package/dist/vendor/starlight/translations/th.json +30 -0
- package/dist/vendor/starlight/translations/th.json.js +32 -0
- package/dist/vendor/starlight/translations/tr.json +30 -0
- package/dist/vendor/starlight/translations/tr.json.js +32 -0
- package/dist/vendor/starlight/translations/uk.json +30 -0
- package/dist/vendor/starlight/translations/uk.json.js +32 -0
- package/dist/vendor/starlight/translations/vi.json +30 -0
- package/dist/vendor/starlight/translations/vi.json.js +32 -0
- package/dist/vendor/starlight/translations/zh-CN.json +30 -0
- package/dist/vendor/starlight/translations/zh-CN.json.js +32 -0
- package/dist/vendor/starlight/translations/zh-TW.json +30 -0
- package/dist/vendor/starlight/translations/zh-TW.json.js +32 -0
- package/dist/vendor/starlight/types.js +0 -0
- package/dist/vendor/starlight/user-components/Aside.astro +40 -0
- package/dist/vendor/starlight/user-components/Badge.astro +148 -0
- package/dist/vendor/starlight/user-components/Card.astro +68 -0
- package/dist/vendor/starlight/user-components/CardGrid.astro +38 -0
- package/dist/vendor/starlight/user-components/FileTree.astro +137 -0
- package/dist/vendor/starlight/user-components/Icon.astro +42 -0
- package/dist/vendor/starlight/user-components/LinkButton.astro +78 -0
- package/dist/vendor/starlight/user-components/LinkCard.astro +78 -0
- package/dist/vendor/starlight/user-components/Steps.astro +90 -0
- package/dist/vendor/starlight/user-components/TabItem.astro +19 -0
- package/dist/vendor/starlight/user-components/Tabs.astro +268 -0
- package/dist/vendor/starlight/user-components/file-tree-icons.js +608 -0
- package/dist/vendor/starlight/user-components/rehype-file-tree.js +160 -0
- package/dist/vendor/starlight/user-components/rehype-steps.js +53 -0
- package/dist/vendor/starlight/user-components/rehype-tabs.js +73 -0
- package/dist/vendor/starlight/utils/base.js +14 -0
- package/dist/vendor/starlight/utils/canonical.js +13 -0
- package/dist/vendor/starlight/utils/collection-fs.js +13 -0
- package/dist/vendor/starlight/utils/collection.js +16 -0
- package/dist/vendor/starlight/utils/createPathFormatter.js +39 -0
- package/dist/vendor/starlight/utils/createTranslationSystem.js +60 -0
- package/dist/vendor/starlight/utils/error-map.js +110 -0
- package/dist/vendor/starlight/utils/format-path.js +9 -0
- package/dist/vendor/starlight/utils/generateToC.js +18 -0
- package/dist/vendor/starlight/utils/git.js +92 -0
- package/dist/vendor/starlight/utils/gitInlined.js +13 -0
- package/dist/vendor/starlight/utils/head.js +156 -0
- package/dist/vendor/starlight/utils/i18n.js +121 -0
- package/dist/vendor/starlight/utils/localizedUrl.js +37 -0
- package/dist/vendor/starlight/utils/navigation.js +320 -0
- package/dist/vendor/starlight/utils/path.js +52 -0
- package/dist/vendor/starlight/utils/plugins.js +355 -0
- package/dist/vendor/starlight/utils/routing/data.js +116 -0
- package/dist/vendor/starlight/utils/routing/index.js +107 -0
- package/dist/vendor/starlight/utils/routing/middleware.js +40 -0
- package/dist/vendor/starlight/utils/routing/types.js +0 -0
- package/dist/vendor/starlight/utils/routing.js +1 -0
- package/dist/vendor/starlight/utils/slugs.js +70 -0
- package/dist/vendor/starlight/utils/starlight-page.js +123 -0
- package/dist/vendor/starlight/utils/translations-fs.js +31 -0
- package/dist/vendor/starlight/utils/translations.js +31 -0
- package/dist/vendor/starlight/utils/types.js +0 -0
- package/dist/vendor/starlight/utils/url.js +5 -0
- package/dist/vendor/starlight/utils/user-config.js +255 -0
- package/dist/vendor/starlight/utils/validateLogoImports.js +22 -0
- package/dist/vendor/starlight/virtual-internal.d.js +0 -0
- package/dist/vendor/starlight/virtual.d.js +0 -0
- package/dist/worker/forms-worker.js +141 -0
- package/package.json +156 -0
- package/style/anchor-links.css +131 -0
- package/templates/github/deploy.workflow.yml +47 -0
- package/tsconfigs/strict.json +3 -0
- package/utils/git.ts +121 -0
- package/utils/gitInlined.ts +20 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import config from "virtual:starlight/user-config";
|
|
2
|
+
import { slugToLocale as getLocaleFromSlug } from "../integrations/shared/slugToLocale.js";
|
|
3
|
+
import { BuiltInDefaultLocale } from "./i18n.js";
|
|
4
|
+
import { stripTrailingSlash } from "./path.js";
|
|
5
|
+
function slugToLocale(slug) {
|
|
6
|
+
return getLocaleFromSlug(slug, config);
|
|
7
|
+
}
|
|
8
|
+
function slugToLocaleData(slug) {
|
|
9
|
+
const locale = slugToLocale(slug);
|
|
10
|
+
return { dir: localeToDir(locale), lang: localeToLang(locale), locale };
|
|
11
|
+
}
|
|
12
|
+
function localeToLang(locale) {
|
|
13
|
+
const lang = locale ? config.locales?.[locale]?.lang : config.locales?.root?.lang;
|
|
14
|
+
const defaultLang = config.defaultLocale?.lang || config.defaultLocale?.locale;
|
|
15
|
+
return lang || defaultLang || BuiltInDefaultLocale.lang;
|
|
16
|
+
}
|
|
17
|
+
function localeToDir(locale) {
|
|
18
|
+
const dir = locale ? config.locales?.[locale]?.dir : config.locales?.root?.dir;
|
|
19
|
+
return dir || config.defaultLocale.dir;
|
|
20
|
+
}
|
|
21
|
+
function slugToParam(slug) {
|
|
22
|
+
return slug === "index" || slug === "" || slug === "/" ? void 0 : (slug.endsWith("/index") ? slug.slice(0, -6) : slug).normalize();
|
|
23
|
+
}
|
|
24
|
+
function slugToPathname(slug) {
|
|
25
|
+
const param = slugToParam(slug);
|
|
26
|
+
return param ? "/" + param + "/" : "/";
|
|
27
|
+
}
|
|
28
|
+
function localizedSlug(slug, locale) {
|
|
29
|
+
const slugLocale = slugToLocale(slug);
|
|
30
|
+
if (slugLocale === locale) return slug;
|
|
31
|
+
locale = locale || "";
|
|
32
|
+
if (slugLocale === slug) return locale;
|
|
33
|
+
if (slugLocale) {
|
|
34
|
+
return stripTrailingSlash(slug.replace(slugLocale + "/", locale ? locale + "/" : ""));
|
|
35
|
+
}
|
|
36
|
+
return slug ? locale + "/" + slug : locale;
|
|
37
|
+
}
|
|
38
|
+
function localizedId(id, locale) {
|
|
39
|
+
const idLocale = slugToLocale(id);
|
|
40
|
+
if (idLocale) {
|
|
41
|
+
return id.replace(idLocale + "/", locale ? locale + "/" : "");
|
|
42
|
+
} else if (locale) {
|
|
43
|
+
return locale + "/" + id;
|
|
44
|
+
} else {
|
|
45
|
+
return id;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function urlToSlug(url) {
|
|
49
|
+
let pathname = url.pathname;
|
|
50
|
+
const base = stripTrailingSlash(import.meta.env.BASE_URL);
|
|
51
|
+
if (pathname.startsWith(base)) pathname = pathname.replace(base, "");
|
|
52
|
+
const segments = pathname.split("/");
|
|
53
|
+
const htmlExt = ".html";
|
|
54
|
+
if (segments.at(-1) === "index.html") {
|
|
55
|
+
segments.pop();
|
|
56
|
+
} else if (segments.at(-1)?.endsWith(htmlExt)) {
|
|
57
|
+
const last = segments.pop();
|
|
58
|
+
if (last) segments.push(last.slice(0, -1 * htmlExt.length));
|
|
59
|
+
}
|
|
60
|
+
return segments.filter(Boolean).join("/");
|
|
61
|
+
}
|
|
62
|
+
export {
|
|
63
|
+
localeToLang,
|
|
64
|
+
localizedId,
|
|
65
|
+
localizedSlug,
|
|
66
|
+
slugToLocaleData,
|
|
67
|
+
slugToParam,
|
|
68
|
+
slugToPathname,
|
|
69
|
+
urlToSlug
|
|
70
|
+
};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { z } from "astro/zod";
|
|
2
|
+
import project from "virtual:starlight/project-context";
|
|
3
|
+
import config from "virtual:starlight/user-config";
|
|
4
|
+
import { getCollectionPathFromRoot } from "./collection.js";
|
|
5
|
+
import { parseWithFriendlyErrors, parseAsyncWithFriendlyErrors } from "./error-map.js";
|
|
6
|
+
import { stripLeadingAndTrailingSlashes } from "./path.js";
|
|
7
|
+
import {
|
|
8
|
+
getSiteTitle,
|
|
9
|
+
getSiteTitleHref,
|
|
10
|
+
getToC
|
|
11
|
+
} from "./routing/data.js";
|
|
12
|
+
import { slugToLocaleData, urlToSlug } from "./slugs.js";
|
|
13
|
+
import { getPrevNextLinks, getSidebar, getSidebarFromConfig } from "./navigation.js";
|
|
14
|
+
import { docsSchema } from "../schema.js";
|
|
15
|
+
import { SidebarItemSchema } from "../schemas/sidebar.js";
|
|
16
|
+
import { getHead } from "./head.js";
|
|
17
|
+
const StarlightPageFrontmatterSchema = async (context) => {
|
|
18
|
+
const userDocsSchema = await getUserDocsSchema();
|
|
19
|
+
const schema = typeof userDocsSchema === "function" ? userDocsSchema(context) : userDocsSchema;
|
|
20
|
+
return schema.transform((frontmatter) => {
|
|
21
|
+
const { editUrl, sidebar, ...others } = frontmatter;
|
|
22
|
+
const pageEditUrl = editUrl === void 0 || editUrl === true ? false : editUrl;
|
|
23
|
+
return { ...others, editUrl: pageEditUrl };
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
const validateSidebarProp = (sidebarProp) => {
|
|
27
|
+
return parseWithFriendlyErrors(
|
|
28
|
+
SidebarItemSchema.array().optional(),
|
|
29
|
+
sidebarProp,
|
|
30
|
+
"Invalid sidebar prop passed to the `<StarlightPage/>` component."
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
async function generateStarlightPageRouteData({
|
|
34
|
+
props,
|
|
35
|
+
context
|
|
36
|
+
}) {
|
|
37
|
+
const { frontmatter, ...routeProps } = props;
|
|
38
|
+
const { url } = context;
|
|
39
|
+
const slug = urlToSlug(url);
|
|
40
|
+
const pageFrontmatter = await getStarlightPageFrontmatter(frontmatter);
|
|
41
|
+
const id = project.legacyCollections ? `${stripLeadingAndTrailingSlashes(slug)}.md` : slug;
|
|
42
|
+
const localeData = slugToLocaleData(slug);
|
|
43
|
+
const sidebar = props.sidebar ? getSidebarFromConfig(validateSidebarProp(props.sidebar), url.pathname, localeData.locale) : getSidebar(url.pathname, localeData.locale);
|
|
44
|
+
const headings = props.headings ?? [];
|
|
45
|
+
const pageDocsEntry = {
|
|
46
|
+
id,
|
|
47
|
+
slug,
|
|
48
|
+
body: "",
|
|
49
|
+
collection: "docs",
|
|
50
|
+
filePath: `${getCollectionPathFromRoot("docs", project)}/${stripLeadingAndTrailingSlashes(slug)}.md`,
|
|
51
|
+
data: {
|
|
52
|
+
...pageFrontmatter,
|
|
53
|
+
sidebar: {
|
|
54
|
+
attrs: {},
|
|
55
|
+
hidden: false
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
const entry = pageDocsEntry;
|
|
60
|
+
const entryMeta = {
|
|
61
|
+
dir: props.dir ?? localeData.dir,
|
|
62
|
+
lang: props.lang ?? localeData.lang,
|
|
63
|
+
locale: localeData.locale
|
|
64
|
+
};
|
|
65
|
+
const editUrl = pageFrontmatter.editUrl ? new URL(pageFrontmatter.editUrl) : void 0;
|
|
66
|
+
const lastUpdated = pageFrontmatter.lastUpdated instanceof Date ? pageFrontmatter.lastUpdated : void 0;
|
|
67
|
+
const pageProps = {
|
|
68
|
+
...routeProps,
|
|
69
|
+
...localeData,
|
|
70
|
+
entry,
|
|
71
|
+
entryMeta,
|
|
72
|
+
headings,
|
|
73
|
+
id,
|
|
74
|
+
locale: localeData.locale,
|
|
75
|
+
slug
|
|
76
|
+
};
|
|
77
|
+
const siteTitle = getSiteTitle(localeData.lang);
|
|
78
|
+
const routeData = {
|
|
79
|
+
...routeProps,
|
|
80
|
+
...localeData,
|
|
81
|
+
id,
|
|
82
|
+
editUrl,
|
|
83
|
+
entry,
|
|
84
|
+
entryMeta,
|
|
85
|
+
hasSidebar: props.hasSidebar ?? entry.data.template !== "splash",
|
|
86
|
+
head: getHead(pageProps, context, siteTitle),
|
|
87
|
+
headings,
|
|
88
|
+
lastUpdated,
|
|
89
|
+
pagination: getPrevNextLinks(sidebar, config.pagination, entry.data),
|
|
90
|
+
sidebar,
|
|
91
|
+
siteTitle,
|
|
92
|
+
siteTitleHref: getSiteTitleHref(localeData.locale),
|
|
93
|
+
slug,
|
|
94
|
+
toc: getToC(pageProps)
|
|
95
|
+
};
|
|
96
|
+
return routeData;
|
|
97
|
+
}
|
|
98
|
+
async function getStarlightPageFrontmatter(frontmatter) {
|
|
99
|
+
const schema = await StarlightPageFrontmatterSchema({
|
|
100
|
+
image: (() => (
|
|
101
|
+
// Mock validator for ImageMetadata.
|
|
102
|
+
// https://github.com/withastro/astro/blob/cf993bc263b58502096f00d383266cd179f331af/packages/astro/src/assets/types.ts#L32
|
|
103
|
+
// It uses a custom validation approach because imported SVGs have a type of `function` as
|
|
104
|
+
// well as containing the metadata properties and this ensures we handle those correctly.
|
|
105
|
+
z.custom(
|
|
106
|
+
(value) => value && (typeof value === "function" || typeof value === "object") && "src" in value && "width" in value && "height" in value && "format" in value,
|
|
107
|
+
"Invalid image passed to `<StarlightPage>` component. Expected imported `ImageMetadata` object."
|
|
108
|
+
)
|
|
109
|
+
))
|
|
110
|
+
});
|
|
111
|
+
return parseAsyncWithFriendlyErrors(
|
|
112
|
+
schema,
|
|
113
|
+
frontmatter,
|
|
114
|
+
"Invalid frontmatter props passed to the `<StarlightPage/>` component."
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
async function getUserDocsSchema() {
|
|
118
|
+
const userCollections = (await import("virtual:starlight/collection-config")).collections;
|
|
119
|
+
return userCollections?.docs?.schema ?? docsSchema();
|
|
120
|
+
}
|
|
121
|
+
export {
|
|
122
|
+
generateStarlightPageRouteData
|
|
123
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import yaml from "js-yaml";
|
|
5
|
+
import { createTranslationSystem } from "./createTranslationSystem.js";
|
|
6
|
+
const contentCollectionFileExtensions = [".json", ".yaml", ".yml"];
|
|
7
|
+
async function createTranslationSystemFromFs(opts, { srcDir }, pluginTranslations = {}) {
|
|
8
|
+
const userTranslations = {};
|
|
9
|
+
try {
|
|
10
|
+
const i18nDir = new URL("content/i18n/", srcDir);
|
|
11
|
+
const files = fs.readdirSync(i18nDir, "utf-8");
|
|
12
|
+
for (const file of files) {
|
|
13
|
+
const filePath = path.parse(file);
|
|
14
|
+
if (!contentCollectionFileExtensions.includes(filePath.ext)) continue;
|
|
15
|
+
const id = filePath.name;
|
|
16
|
+
const url = new URL(filePath.base, i18nDir);
|
|
17
|
+
const content = fs.readFileSync(new URL(file, i18nDir), "utf-8");
|
|
18
|
+
const data = filePath.ext === ".json" ? JSON.parse(content) : yaml.load(content, { filename: fileURLToPath(url) });
|
|
19
|
+
userTranslations[id] = data;
|
|
20
|
+
}
|
|
21
|
+
} catch (e) {
|
|
22
|
+
if (e instanceof Error && "code" in e && e.code === "ENOENT") {
|
|
23
|
+
} else {
|
|
24
|
+
throw e;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return createTranslationSystem(opts, userTranslations, pluginTranslations);
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
createTranslationSystemFromFs
|
|
31
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { getCollection } from "astro:content";
|
|
2
|
+
import config from "virtual:starlight/user-config";
|
|
3
|
+
import project from "virtual:starlight/project-context";
|
|
4
|
+
import pluginTranslations from "virtual:starlight/plugin-translations";
|
|
5
|
+
import { createTranslationSystem } from "./createTranslationSystem.js";
|
|
6
|
+
import { getCollectionPathFromRoot } from "./collection.js";
|
|
7
|
+
import { stripExtension, stripLeadingSlash } from "./path.js";
|
|
8
|
+
const i18nCollectionPathFromRoot = getCollectionPathFromRoot("i18n", project);
|
|
9
|
+
async function loadTranslations() {
|
|
10
|
+
const warn = console.warn;
|
|
11
|
+
console.warn = () => {
|
|
12
|
+
};
|
|
13
|
+
const userTranslations = Object.fromEntries(
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
15
|
+
// @ts-ignore — may be a type error in projects without an i18n collection
|
|
16
|
+
(await getCollection("i18n")).map(({ id, data, filePath }) => {
|
|
17
|
+
const lang = project.legacyCollections || !filePath ? id : stripExtension(stripLeadingSlash(filePath.replace(i18nCollectionPathFromRoot, "")));
|
|
18
|
+
return [lang, data];
|
|
19
|
+
})
|
|
20
|
+
);
|
|
21
|
+
console.warn = warn;
|
|
22
|
+
return userTranslations;
|
|
23
|
+
}
|
|
24
|
+
const useTranslations = await createTranslationSystem(
|
|
25
|
+
config,
|
|
26
|
+
await loadTranslations(),
|
|
27
|
+
pluginTranslations
|
|
28
|
+
);
|
|
29
|
+
export {
|
|
30
|
+
useTranslations
|
|
31
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { z } from "astro/zod";
|
|
2
|
+
import { parse as bcpParse, stringify as bcpStringify } from "bcp-47";
|
|
3
|
+
import { ComponentConfigSchema } from "../schemas/components.js";
|
|
4
|
+
import { ExpressiveCodeSchema } from "../schemas/expressiveCode.js";
|
|
5
|
+
import { FaviconSchema } from "../schemas/favicon.js";
|
|
6
|
+
import { HeadConfigSchema } from "../schemas/head.js";
|
|
7
|
+
import { LogoConfigSchema } from "../schemas/logo.js";
|
|
8
|
+
import { PagefindConfigDefaults, PagefindConfigSchema } from "../schemas/pagefind.js";
|
|
9
|
+
import { SidebarItemSchema } from "../schemas/sidebar.js";
|
|
10
|
+
import { TitleConfigSchema, TitleTransformConfigSchema } from "../schemas/site-title.js";
|
|
11
|
+
import { SocialLinksSchema } from "../schemas/social.js";
|
|
12
|
+
import { TableOfContentsSchema } from "../schemas/tableOfContents.js";
|
|
13
|
+
import { BuiltInDefaultLocale } from "./i18n.js";
|
|
14
|
+
const LocaleSchema = z.object({
|
|
15
|
+
/** The label for this language to show in UI, e.g. `"English"`, `"العربية"`, or `"简体中文"`. */
|
|
16
|
+
label: z.string().describe(
|
|
17
|
+
'The label for this language to show in UI, e.g. `"English"`, `"\u0627\u0644\u0639\u0631\u0628\u064A\u0629"`, or `"\u7B80\u4F53\u4E2D\u6587"`.'
|
|
18
|
+
),
|
|
19
|
+
/** The BCP-47 tag for this language, e.g. `"en"`, `"ar"`, or `"zh-CN"`. */
|
|
20
|
+
lang: z.string().optional().describe('The BCP-47 tag for this language, e.g. `"en"`, `"ar"`, or `"zh-CN"`.'),
|
|
21
|
+
/** The writing direction of this language; `"ltr"` for left-to-right (the default) or `"rtl"` for right-to-left. */
|
|
22
|
+
dir: z.enum(["rtl", "ltr"]).optional().default("ltr").describe(
|
|
23
|
+
'The writing direction of this language; `"ltr"` for left-to-right (the default) or `"rtl"` for right-to-left.'
|
|
24
|
+
)
|
|
25
|
+
});
|
|
26
|
+
const UserConfigSchema = z.object({
|
|
27
|
+
/** Title for your website. Will be used in metadata and as browser tab title. */
|
|
28
|
+
title: TitleConfigSchema(),
|
|
29
|
+
/** Description metadata for your website. Can be used in page metadata. */
|
|
30
|
+
description: z.string().optional().describe("Description metadata for your website. Can be used in page metadata."),
|
|
31
|
+
/** Set a logo image to show in the navigation bar alongside or instead of the site title. */
|
|
32
|
+
logo: LogoConfigSchema(),
|
|
33
|
+
/**
|
|
34
|
+
* Optional details about the social media accounts for this site.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* social: [
|
|
38
|
+
* { icon: 'codeberg', label: 'Codeberg', href: 'https://codeberg.org/knut' },
|
|
39
|
+
* { icon: 'discord', label: 'Discord', href: 'https://astro.build/chat' },
|
|
40
|
+
* { icon: 'github', label: 'GitHub', href: 'https://github.com/withastro' },
|
|
41
|
+
* { icon: 'gitlab', label: 'GitLab', href: 'https://gitlab.com/delucis' },
|
|
42
|
+
* { icon: 'mastodon', label: 'Mastodon', href: 'https://m.webtoo.ls/@astro' },
|
|
43
|
+
* ]
|
|
44
|
+
*/
|
|
45
|
+
social: SocialLinksSchema(),
|
|
46
|
+
/** The tagline for your website. */
|
|
47
|
+
tagline: z.string().optional().describe("The tagline for your website."),
|
|
48
|
+
/** Configure the defaults for the table of contents on each page. */
|
|
49
|
+
tableOfContents: TableOfContentsSchema(),
|
|
50
|
+
/** Enable and configure “Edit this page” links. */
|
|
51
|
+
editLink: z.object({
|
|
52
|
+
/** Set the base URL for edit links. The final link will be `baseUrl` + the current page path. */
|
|
53
|
+
baseUrl: z.string().url().optional()
|
|
54
|
+
}).optional().default({}),
|
|
55
|
+
/** Configure locales for internationalization (i18n). */
|
|
56
|
+
locales: z.object({
|
|
57
|
+
/** Configure a “root” locale to serve a default language from `/`. */
|
|
58
|
+
root: LocaleSchema.required({ lang: true }).optional()
|
|
59
|
+
}).catchall(LocaleSchema).transform((locales, ctx) => {
|
|
60
|
+
for (const key in locales) {
|
|
61
|
+
const locale = locales[key];
|
|
62
|
+
let lang = locale.lang || key;
|
|
63
|
+
const schema = bcpParse(lang, { forgiving: true });
|
|
64
|
+
schema.region = schema.region?.toUpperCase();
|
|
65
|
+
const normalizedLang = bcpStringify(schema);
|
|
66
|
+
if (!normalizedLang) {
|
|
67
|
+
ctx.addIssue({
|
|
68
|
+
code: z.ZodIssueCode.custom,
|
|
69
|
+
message: `Could not validate language tag "${lang}" at locales.${key}.lang.`
|
|
70
|
+
});
|
|
71
|
+
return z.NEVER;
|
|
72
|
+
}
|
|
73
|
+
if (normalizedLang !== lang) {
|
|
74
|
+
console.warn(
|
|
75
|
+
`Warning: using "${normalizedLang}" language tag for locales.${key}.lang instead of "${lang}".`
|
|
76
|
+
);
|
|
77
|
+
lang = normalizedLang;
|
|
78
|
+
}
|
|
79
|
+
locale.lang = lang;
|
|
80
|
+
}
|
|
81
|
+
return locales;
|
|
82
|
+
}).optional().describe("Configure locales for internationalization (i18n)."),
|
|
83
|
+
/**
|
|
84
|
+
* Specify the default language for this site.
|
|
85
|
+
*
|
|
86
|
+
* The default locale will be used to provide fallback content where translations are missing.
|
|
87
|
+
*/
|
|
88
|
+
defaultLocale: z.string().optional(),
|
|
89
|
+
/** Configure your site’s sidebar navigation items. */
|
|
90
|
+
sidebar: SidebarItemSchema.array().optional(),
|
|
91
|
+
/**
|
|
92
|
+
* Add extra tags to your site’s `<head>`.
|
|
93
|
+
*
|
|
94
|
+
* Can also be set for a single page in a page’s frontmatter.
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* // Add Fathom analytics to your site
|
|
98
|
+
* starlight({
|
|
99
|
+
* head: [
|
|
100
|
+
* {
|
|
101
|
+
* tag: 'script',
|
|
102
|
+
* attrs: {
|
|
103
|
+
* src: 'https://cdn.usefathom.com/script.js',
|
|
104
|
+
* 'data-site': 'MY-FATHOM-ID',
|
|
105
|
+
* defer: true,
|
|
106
|
+
* },
|
|
107
|
+
* },
|
|
108
|
+
* ],
|
|
109
|
+
* })
|
|
110
|
+
*/
|
|
111
|
+
head: HeadConfigSchema({ source: "config" }),
|
|
112
|
+
/**
|
|
113
|
+
* Provide CSS files to customize the look and feel of your Starlight site.
|
|
114
|
+
*
|
|
115
|
+
* Supports local CSS files relative to the root of your project,
|
|
116
|
+
* e.g. `'/src/custom.css'`, and CSS you installed as an npm
|
|
117
|
+
* module, e.g. `'@fontsource/roboto'`.
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* starlight({
|
|
121
|
+
* customCss: ['/src/custom-styles.css', '@fontsource/roboto'],
|
|
122
|
+
* })
|
|
123
|
+
*/
|
|
124
|
+
customCss: z.string().array().optional().default([]).superRefine((paths, ctx) => {
|
|
125
|
+
const invalidPathRegex = /^\.?\/public\/.+$/;
|
|
126
|
+
const invalidPaths = paths.filter((path) => invalidPathRegex.test(path));
|
|
127
|
+
if (invalidPaths.length > 0) {
|
|
128
|
+
ctx.addIssue({
|
|
129
|
+
code: "custom",
|
|
130
|
+
message: `These paths in your Starlight \`customCss\` config are invalid: ${invalidPaths.map((path) => `\`"${path}"\``).join(", ")}
|
|
131
|
+
|
|
132
|
+
CSS files specified in \`customCss\` should be in the \`src/\` directory, not the \`public/\` directory.
|
|
133
|
+
|
|
134
|
+
You should move these CSS files into the \`src/\` directory and update the path in \`customCss\` to match.`
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}),
|
|
138
|
+
/** Define if the last update date should be visible in the page footer. */
|
|
139
|
+
lastUpdated: z.boolean().default(false).describe("Define if the last update date should be visible in the page footer."),
|
|
140
|
+
/** Define if the previous and next page links should be visible in the page footer. */
|
|
141
|
+
pagination: z.boolean().default(true).describe("Define if the previous and next page links should be visible in the page footer."),
|
|
142
|
+
/** The default favicon for your site which should be a path to an image in the `public/` directory. */
|
|
143
|
+
favicon: FaviconSchema(),
|
|
144
|
+
/**
|
|
145
|
+
* Define how code blocks are rendered by passing options to Expressive Code,
|
|
146
|
+
* or disable the integration by passing `false`.
|
|
147
|
+
*/
|
|
148
|
+
expressiveCode: ExpressiveCodeSchema(),
|
|
149
|
+
/**
|
|
150
|
+
* Configure Starlight’s default site search provider Pagefind. Set to `false` to disable indexing
|
|
151
|
+
* your site with Pagefind, which will also hide the default search UI if in use.
|
|
152
|
+
*/
|
|
153
|
+
pagefind: z.boolean().transform((val) => val && PagefindConfigDefaults()).or(PagefindConfigSchema()).optional(),
|
|
154
|
+
/** Specify paths to components that should override Starlight’s default components */
|
|
155
|
+
components: ComponentConfigSchema(),
|
|
156
|
+
/** Will be used as title delimiter in the generated `<title>` tag. */
|
|
157
|
+
titleDelimiter: z.string().default("|").describe("Will be used as title delimiter in the generated `<title>` tag."),
|
|
158
|
+
/** Disable Starlight's default 404 page. */
|
|
159
|
+
disable404Route: z.boolean().default(false).describe("Disable Starlight's default 404 page."),
|
|
160
|
+
/**
|
|
161
|
+
* Define whether Starlight pages should be prerendered or not.
|
|
162
|
+
* Defaults to always prerender Starlight pages, even when the project is
|
|
163
|
+
* set to "server" output mode.
|
|
164
|
+
*/
|
|
165
|
+
prerender: z.boolean().default(true),
|
|
166
|
+
/** Enable displaying a “Built with Starlight” link in your site’s footer. */
|
|
167
|
+
credits: z.boolean().default(false).describe("Enable displaying a \u201CBuilt with Starlight\u201D link in your site\u2019s footer."),
|
|
168
|
+
/** Add middleware to process Starlight’s route data for each page. */
|
|
169
|
+
routeMiddleware: z.string().transform((string) => [string]).or(z.string().array()).default([]).superRefine((middlewares, ctx) => {
|
|
170
|
+
const invalidPathRegex = /^\.?\/src\/middleware(?:\/index)?\.[jt]s$/;
|
|
171
|
+
const invalidPaths = middlewares.filter((middleware) => invalidPathRegex.test(middleware));
|
|
172
|
+
for (const invalidPath of invalidPaths) {
|
|
173
|
+
ctx.addIssue({
|
|
174
|
+
code: "custom",
|
|
175
|
+
message: `The \`"${invalidPath}"\` path in your Starlight \`routeMiddleware\` config conflicts with Astro\u2019s middleware locations.
|
|
176
|
+
|
|
177
|
+
You should rename \`${invalidPath}\` to something else like \`./src/starlightRouteData.ts\` and update the \`routeMiddleware\` file path to match.
|
|
178
|
+
|
|
179
|
+
- More about Starlight route middleware: https://starlight.astro.build/guides/route-data/#how-to-customize-route-data
|
|
180
|
+
- More about Astro middleware: https://docs.astro.build/en/guides/middleware/`
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
}).describe("Add middleware to process Starlight\u2019s route data for each page."),
|
|
184
|
+
/** Configure features that impact Starlight’s Markdown processing. */
|
|
185
|
+
markdown: z.object({
|
|
186
|
+
/** Define whether headings in content should be rendered with clickable anchor links. Default: `true`. */
|
|
187
|
+
headingLinks: z.boolean().default(true).describe(
|
|
188
|
+
"Define whether headings in content should be rendered with clickable anchor links. Default: `true`."
|
|
189
|
+
),
|
|
190
|
+
/**
|
|
191
|
+
* Define additional directories where files should be processed by Starlight’s Markdown pipeline.
|
|
192
|
+
*
|
|
193
|
+
* Supports local directories relative to the root of your project, e.g. './src/data/comments/'.
|
|
194
|
+
* Content of the `docs` content collection is always processed by Starlight’s Markdown pipeline.
|
|
195
|
+
*/
|
|
196
|
+
processedDirs: z.string().array().default([]).describe(
|
|
197
|
+
"Define additional directories where files should be processed by Starlight\u2019s Markdown pipeline. Default: `[]`."
|
|
198
|
+
)
|
|
199
|
+
}).default({}).describe("Configure features that impact Starlight\u2019s Markdown processing.")
|
|
200
|
+
});
|
|
201
|
+
const StarlightConfigSchema = UserConfigSchema.strict().transform((config) => ({
|
|
202
|
+
...config,
|
|
203
|
+
// Pagefind only defaults to true if prerender is also true.
|
|
204
|
+
pagefind: typeof config.pagefind === "undefined" ? config.prerender && PagefindConfigDefaults() : config.pagefind
|
|
205
|
+
})).refine((config) => !(!config.prerender && config.pagefind), {
|
|
206
|
+
message: "Pagefind search is not supported with prerendering disabled."
|
|
207
|
+
}).transform(({ title, locales, defaultLocale, ...config }, ctx) => {
|
|
208
|
+
const configuredLocales = Object.keys(locales ?? {});
|
|
209
|
+
if (locales !== void 0 && (configuredLocales.length > 1 || configuredLocales.length === 1 && locales.root === void 0)) {
|
|
210
|
+
const defaultLocaleConfig2 = locales[defaultLocale || "root"];
|
|
211
|
+
if (!defaultLocaleConfig2) {
|
|
212
|
+
const availableLocales = configuredLocales.map((l) => `"${l}"`).join(", ");
|
|
213
|
+
ctx.addIssue({
|
|
214
|
+
code: "custom",
|
|
215
|
+
message: "Could not determine the default locale. Please make sure `defaultLocale` in your Starlight config is one of " + availableLocales
|
|
216
|
+
});
|
|
217
|
+
return z.NEVER;
|
|
218
|
+
}
|
|
219
|
+
const TitleSchema2 = TitleTransformConfigSchema(defaultLocaleConfig2.lang);
|
|
220
|
+
const parsedTitle2 = TitleSchema2.parse(title);
|
|
221
|
+
return {
|
|
222
|
+
...config,
|
|
223
|
+
title: parsedTitle2,
|
|
224
|
+
/** Flag indicating if this site has multiple locales set up. */
|
|
225
|
+
isMultilingual: configuredLocales.length > 1,
|
|
226
|
+
/** Flag indicating if the Starlight built-in default locale is used. */
|
|
227
|
+
isUsingBuiltInDefaultLocale: false,
|
|
228
|
+
/** Full locale object for this site’s default language. */
|
|
229
|
+
defaultLocale: { ...defaultLocaleConfig2, locale: defaultLocale },
|
|
230
|
+
locales
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
const defaultLocaleConfig = {
|
|
234
|
+
label: BuiltInDefaultLocale.label,
|
|
235
|
+
lang: BuiltInDefaultLocale.lang,
|
|
236
|
+
dir: BuiltInDefaultLocale.dir,
|
|
237
|
+
locale: void 0,
|
|
238
|
+
...locales?.root
|
|
239
|
+
};
|
|
240
|
+
const TitleSchema = TitleTransformConfigSchema(defaultLocaleConfig.lang);
|
|
241
|
+
const parsedTitle = TitleSchema.parse(title);
|
|
242
|
+
return {
|
|
243
|
+
...config,
|
|
244
|
+
title: parsedTitle,
|
|
245
|
+
/** Flag indicating if this site has multiple locales set up. */
|
|
246
|
+
isMultilingual: false,
|
|
247
|
+
/** Flag indicating if the Starlight built-in default locale is used. */
|
|
248
|
+
isUsingBuiltInDefaultLocale: locales?.root === void 0,
|
|
249
|
+
defaultLocale: defaultLocaleConfig,
|
|
250
|
+
locales: void 0
|
|
251
|
+
};
|
|
252
|
+
});
|
|
253
|
+
export {
|
|
254
|
+
StarlightConfigSchema
|
|
255
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import config from "virtual:starlight/user-config";
|
|
2
|
+
import { logos } from "virtual:starlight/user-images";
|
|
3
|
+
function validateLogoImports() {
|
|
4
|
+
if (config.logo) {
|
|
5
|
+
let err;
|
|
6
|
+
if ("src" in config.logo) {
|
|
7
|
+
if (!logos.dark || !logos.light) {
|
|
8
|
+
err = `Could not resolve logo import for "${config.logo.src}" (logo.src)`;
|
|
9
|
+
}
|
|
10
|
+
} else {
|
|
11
|
+
if (!logos.dark) {
|
|
12
|
+
err = `Could not resolve logo import for "${config.logo.dark}" (logo.dark)`;
|
|
13
|
+
} else if (!logos.light) {
|
|
14
|
+
err = `Could not resolve logo import for "${config.logo.light}" (logo.light)`;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
if (err) throw new Error(err);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
validateLogoImports
|
|
22
|
+
};
|
|
File without changes
|
|
File without changes
|