@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,141 @@
|
|
|
1
|
+
import { deriveFormRuntimeCapabilities } from "../utils/forms/runtime-core.js";
|
|
2
|
+
import { resolveBuiltinFormsProvider } from "../utils/forms/provider-core.js";
|
|
3
|
+
import { handleFormSubmissionWithConfig, handleTokenRequestWithConfig } from "../utils/forms/service-core.js";
|
|
4
|
+
function envBoolean(value) {
|
|
5
|
+
if (typeof value === "boolean") {
|
|
6
|
+
return value;
|
|
7
|
+
}
|
|
8
|
+
if (typeof value === "string") {
|
|
9
|
+
return value === "true";
|
|
10
|
+
}
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
function getCookieValue(request, name) {
|
|
14
|
+
const cookieHeader = request.headers.get("cookie") ?? "";
|
|
15
|
+
for (const chunk of cookieHeader.split(";")) {
|
|
16
|
+
const [key, ...rest] = chunk.trim().split("=");
|
|
17
|
+
if (key === name) {
|
|
18
|
+
return decodeURIComponent(rest.join("="));
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return void 0;
|
|
22
|
+
}
|
|
23
|
+
function serializeCookie(cookie) {
|
|
24
|
+
const parts = [`${cookie.name}=${encodeURIComponent(cookie.value)}`];
|
|
25
|
+
const { options } = cookie;
|
|
26
|
+
if (options.maxAge) {
|
|
27
|
+
parts.push(`Max-Age=${String(options.maxAge)}`);
|
|
28
|
+
}
|
|
29
|
+
if (options.path) {
|
|
30
|
+
parts.push(`Path=${String(options.path)}`);
|
|
31
|
+
}
|
|
32
|
+
if (options.sameSite) {
|
|
33
|
+
parts.push(`SameSite=${String(options.sameSite)}`);
|
|
34
|
+
}
|
|
35
|
+
if (options.httpOnly) {
|
|
36
|
+
parts.push("HttpOnly");
|
|
37
|
+
}
|
|
38
|
+
if (options.secure) {
|
|
39
|
+
parts.push("Secure");
|
|
40
|
+
}
|
|
41
|
+
return parts.join("; ");
|
|
42
|
+
}
|
|
43
|
+
function buildSmtpConfig(env) {
|
|
44
|
+
const useMailpit = envBoolean(env.TREESEED_FORMS_LOCAL_USE_MAILPIT);
|
|
45
|
+
return {
|
|
46
|
+
host: useMailpit ? env.TREESEED_MAILPIT_SMTP_HOST ?? env.TREESEED_SMTP_HOST ?? "127.0.0.1" : env.TREESEED_SMTP_HOST ?? "",
|
|
47
|
+
port: Number(useMailpit ? env.TREESEED_MAILPIT_SMTP_PORT ?? env.TREESEED_SMTP_PORT ?? "1025" : env.TREESEED_SMTP_PORT ?? "465"),
|
|
48
|
+
username: env.TREESEED_SMTP_USERNAME ?? "",
|
|
49
|
+
password: env.TREESEED_SMTP_PASSWORD ?? "",
|
|
50
|
+
from: env.TREESEED_SMTP_FROM ?? "",
|
|
51
|
+
replyTo: env.TREESEED_SMTP_REPLY_TO ?? ""
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function isSmtpEnabled(env) {
|
|
55
|
+
const smtp = buildSmtpConfig(env);
|
|
56
|
+
const useMailpit = envBoolean(env.TREESEED_FORMS_LOCAL_USE_MAILPIT);
|
|
57
|
+
if (useMailpit) {
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
return Boolean(__TREESEED_DEPLOY_CONFIG__.smtp?.enabled && smtp.host && smtp.port && smtp.from);
|
|
61
|
+
}
|
|
62
|
+
function isTurnstileEnabled(env) {
|
|
63
|
+
return Boolean(env.TREESEED_TURNSTILE_SECRET_KEY);
|
|
64
|
+
}
|
|
65
|
+
function buildRuntime(env) {
|
|
66
|
+
return deriveFormRuntimeCapabilities({
|
|
67
|
+
isCloudflareRuntime: true,
|
|
68
|
+
localDevMode: env.TREESEED_LOCAL_DEV_MODE === "cloudflare" ? "cloudflare" : null,
|
|
69
|
+
isDevServer: false,
|
|
70
|
+
bypassTurnstile: envBoolean(env.TREESEED_FORMS_LOCAL_BYPASS_TURNSTILE),
|
|
71
|
+
bypassCloudflareGuards: envBoolean(env.TREESEED_FORMS_LOCAL_BYPASS_CLOUDFLARE_GUARDS),
|
|
72
|
+
useMailpit: envBoolean(env.TREESEED_FORMS_LOCAL_USE_MAILPIT),
|
|
73
|
+
formsMode: __TREESEED_DEPLOY_CONFIG__.providers?.forms ?? "store_only",
|
|
74
|
+
smtpEnabled: isSmtpEnabled(env),
|
|
75
|
+
turnstileEnabled: isTurnstileEnabled(env)
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
function buildFormConfig(env) {
|
|
79
|
+
return {
|
|
80
|
+
runtime: buildRuntime(env),
|
|
81
|
+
formsProvider: resolveBuiltinFormsProvider(__TREESEED_DEPLOY_CONFIG__.providers?.forms ?? "store_only"),
|
|
82
|
+
bindings: {
|
|
83
|
+
FORM_GUARD_KV: env.FORM_GUARD_KV,
|
|
84
|
+
SITE_DATA_DB: env.SITE_DATA_DB,
|
|
85
|
+
SESSION: env.SESSION
|
|
86
|
+
},
|
|
87
|
+
formSecret: env.TREESEED_FORM_TOKEN_SECRET ?? "",
|
|
88
|
+
turnstileSecret: env.TREESEED_TURNSTILE_SECRET_KEY ?? "",
|
|
89
|
+
contactRouting: __TREESEED_SITE_CONFIG__.site.emailNotifications.contactRouting,
|
|
90
|
+
subscribeRecipients: __TREESEED_SITE_CONFIG__.site.emailNotifications.subscribeRecipients,
|
|
91
|
+
smtpConfig: buildSmtpConfig(env),
|
|
92
|
+
siteUrl: __TREESEED_SITE_CONFIG__.site.siteUrl
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
async function handleApiRequest(request, env) {
|
|
96
|
+
const url = new URL(request.url);
|
|
97
|
+
const responseHeaders = new Headers();
|
|
98
|
+
const context = {
|
|
99
|
+
request,
|
|
100
|
+
url,
|
|
101
|
+
getCookie(name) {
|
|
102
|
+
return getCookieValue(request, name);
|
|
103
|
+
},
|
|
104
|
+
setCookie(cookie) {
|
|
105
|
+
responseHeaders.append("set-cookie", serializeCookie(cookie));
|
|
106
|
+
},
|
|
107
|
+
redirect(location, status) {
|
|
108
|
+
const headers = new Headers(responseHeaders);
|
|
109
|
+
headers.set("location", location);
|
|
110
|
+
return new Response(null, { status, headers });
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
const config = buildFormConfig(env);
|
|
114
|
+
if (request.method === "GET") {
|
|
115
|
+
const response = await handleTokenRequestWithConfig(context, config);
|
|
116
|
+
responseHeaders.forEach((value, key) => response.headers.append(key, value));
|
|
117
|
+
return response;
|
|
118
|
+
}
|
|
119
|
+
if (request.method === "POST") {
|
|
120
|
+
const result = await handleFormSubmissionWithConfig(context, config);
|
|
121
|
+
return context.redirect(result.redirectTo, 303);
|
|
122
|
+
}
|
|
123
|
+
return new Response("Method Not Allowed", {
|
|
124
|
+
status: 405,
|
|
125
|
+
headers: {
|
|
126
|
+
allow: "GET, POST"
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
var forms_worker_default = {
|
|
131
|
+
async fetch(request, env) {
|
|
132
|
+
const url = new URL(request.url);
|
|
133
|
+
if (url.pathname === "/api/form/submit") {
|
|
134
|
+
return handleApiRequest(request, env);
|
|
135
|
+
}
|
|
136
|
+
return env.ASSETS.fetch(request);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
export {
|
|
140
|
+
forms_worker_default as default
|
|
141
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@treeseed/core",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Treeseed platform runtime package for Astro, Starlight, forms, books, plugins, and shared platform behavior.",
|
|
5
|
+
"license": "AGPL-3.0-only",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/treeseed-ai/core.git",
|
|
9
|
+
"directory": "."
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://treeseed.ai",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/treeseed-ai/core/issues"
|
|
14
|
+
},
|
|
15
|
+
"type": "module",
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=20"
|
|
18
|
+
},
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"files": [
|
|
21
|
+
"README.md",
|
|
22
|
+
"dist",
|
|
23
|
+
"tsconfigs",
|
|
24
|
+
"templates",
|
|
25
|
+
"style",
|
|
26
|
+
"utils"
|
|
27
|
+
],
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public"
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"setup": "npm install",
|
|
33
|
+
"setup:ci": "npm ci",
|
|
34
|
+
"build:dist": "node ./scripts/run-ts.mjs ./scripts/build-dist.ts",
|
|
35
|
+
"prepare": "npm run build:dist",
|
|
36
|
+
"prepack": "npm run build:dist",
|
|
37
|
+
"starlight:patch": "node ./scripts/run-ts.mjs ./scripts/patch-starlight-content-path.ts",
|
|
38
|
+
"precheck": "npm run starlight:patch",
|
|
39
|
+
"check": "node ./scripts/run-ts.mjs ./scripts/run-fixture-astro-command.ts check",
|
|
40
|
+
"prebuild": "npm run starlight:patch && node ./scripts/run-ts.mjs ./scripts/aggregate-book.ts",
|
|
41
|
+
"build": "TREESEED_LOCAL_DEV_MODE=cloudflare node ./scripts/run-ts.mjs ./scripts/run-fixture-astro-command.ts build",
|
|
42
|
+
"preview": "node ./scripts/run-ts.mjs ./scripts/run-fixture-astro-command.ts preview",
|
|
43
|
+
"test:unit": "vitest run --config ./vitest.config.ts",
|
|
44
|
+
"test": "npm run test:unit",
|
|
45
|
+
"verify": "npm run release:verify",
|
|
46
|
+
"test:smoke": "node ./scripts/run-ts.mjs ./scripts/test-smoke.ts",
|
|
47
|
+
"fixtures:resolve": "node ./scripts/run-ts.mjs ./scripts/fixture-tools.ts resolve",
|
|
48
|
+
"fixtures:check": "node ./scripts/run-ts.mjs ./scripts/fixture-tools.ts check",
|
|
49
|
+
"release:setup": "npm run setup:ci",
|
|
50
|
+
"release:check-tag": "node ./scripts/run-ts.mjs ./scripts/assert-release-tag-version.ts",
|
|
51
|
+
"release:verify": "node ./scripts/run-ts.mjs ./scripts/release-verify.ts",
|
|
52
|
+
"release:publish": "node ./scripts/run-ts.mjs ./scripts/publish-package.ts"
|
|
53
|
+
},
|
|
54
|
+
"dependencies": {
|
|
55
|
+
"@treeseed/sdk": "^0.1.1",
|
|
56
|
+
"@astrojs/check": "^0.9.8",
|
|
57
|
+
"@astrojs/cloudflare": "^12.6.13",
|
|
58
|
+
"@astrojs/sitemap": "3.7.0",
|
|
59
|
+
"@astrojs/starlight": "0.37.6",
|
|
60
|
+
"@tailwindcss/vite": "^4.1.4",
|
|
61
|
+
"astro": "^5.6.1",
|
|
62
|
+
"esbuild": "^0.28.0",
|
|
63
|
+
"katex": "^0.16.22",
|
|
64
|
+
"nodemailer": "^8.0.4",
|
|
65
|
+
"rehype-katex": "^7.0.1",
|
|
66
|
+
"remark-frontmatter": "^5.0.0",
|
|
67
|
+
"remark-gfm": "^4.0.1",
|
|
68
|
+
"remark-mdx": "^3.1.1",
|
|
69
|
+
"remark-math": "^6.0.0",
|
|
70
|
+
"remark-parse": "^11.0.0",
|
|
71
|
+
"remark-stringify": "^11.0.0",
|
|
72
|
+
"tailwindcss": "^4.1.4",
|
|
73
|
+
"typescript": "^5.9.3",
|
|
74
|
+
"unified": "^11.0.5",
|
|
75
|
+
"vitest": "^4.1.2",
|
|
76
|
+
"wrangler": "^4.80.0",
|
|
77
|
+
"yaml": "^2.8.1"
|
|
78
|
+
},
|
|
79
|
+
"devDependencies": {
|
|
80
|
+
"@types/nodemailer": "^7.0.11"
|
|
81
|
+
},
|
|
82
|
+
"exports": {
|
|
83
|
+
".": {
|
|
84
|
+
"types": "./dist/index.d.ts",
|
|
85
|
+
"default": "./dist/index.js"
|
|
86
|
+
},
|
|
87
|
+
"./site": {
|
|
88
|
+
"types": "./dist/site.d.ts",
|
|
89
|
+
"default": "./dist/site.js"
|
|
90
|
+
},
|
|
91
|
+
"./config": {
|
|
92
|
+
"types": "./dist/config.d.ts",
|
|
93
|
+
"default": "./dist/config.js"
|
|
94
|
+
},
|
|
95
|
+
"./deploy/config": {
|
|
96
|
+
"types": "./dist/deploy/config.d.ts",
|
|
97
|
+
"default": "./dist/deploy/config.js"
|
|
98
|
+
},
|
|
99
|
+
"./deploy/runtime": {
|
|
100
|
+
"default": "./dist/deploy/runtime.js"
|
|
101
|
+
},
|
|
102
|
+
"./content": {
|
|
103
|
+
"types": "./dist/content.d.ts",
|
|
104
|
+
"default": "./dist/content.js"
|
|
105
|
+
},
|
|
106
|
+
"./content-config": {
|
|
107
|
+
"types": "./dist/content-config.d.ts",
|
|
108
|
+
"default": "./dist/content-config.js"
|
|
109
|
+
},
|
|
110
|
+
"./tenant": "./dist/tenant/bridge.js",
|
|
111
|
+
"./tenant-config": {
|
|
112
|
+
"types": "./dist/tenant/config.d.ts",
|
|
113
|
+
"default": "./dist/tenant/config.js"
|
|
114
|
+
},
|
|
115
|
+
"./contracts": "./dist/contracts.js",
|
|
116
|
+
"./plugin-default": {
|
|
117
|
+
"types": "./dist/plugin-default.d.ts",
|
|
118
|
+
"default": "./dist/plugin-default.js"
|
|
119
|
+
},
|
|
120
|
+
"./plugins/plugin": {
|
|
121
|
+
"types": "./dist/plugins/plugin.d.ts",
|
|
122
|
+
"default": "./dist/plugins/plugin.js"
|
|
123
|
+
},
|
|
124
|
+
"./plugins/runtime": {
|
|
125
|
+
"types": "./dist/plugins/runtime.d.ts",
|
|
126
|
+
"default": "./dist/plugins/runtime.js"
|
|
127
|
+
},
|
|
128
|
+
"./environment": {
|
|
129
|
+
"types": "./dist/environment.d.ts",
|
|
130
|
+
"default": "./dist/environment.js"
|
|
131
|
+
},
|
|
132
|
+
"./site-resources": {
|
|
133
|
+
"types": "./dist/site-resources.d.ts",
|
|
134
|
+
"default": "./dist/site-resources.js"
|
|
135
|
+
},
|
|
136
|
+
"./types/agents": "./dist/types/agents.js",
|
|
137
|
+
"./types/cloudflare": "./dist/types/cloudflare.js",
|
|
138
|
+
"./agents/registry-helper": "./dist/agents/registry-helper.js",
|
|
139
|
+
"./utils/seo": "./dist/utils/seo.js",
|
|
140
|
+
"./utils/site-config-schema": "./dist/utils/site-config-schema.js",
|
|
141
|
+
"./utils/books-data": "./dist/utils/books-data.js",
|
|
142
|
+
"./utils/agents/runtime-types": "./dist/utils/agents/runtime-types.js",
|
|
143
|
+
"./utils/agents/contracts/messages": "./dist/utils/agents/contracts/messages.js",
|
|
144
|
+
"./utils/agents/contracts/run": "./dist/utils/agents/contracts/run.js",
|
|
145
|
+
"./components/site/CTASection.astro": "./dist/components/site/CTASection.astro",
|
|
146
|
+
"./components/site/SectionIntro.astro": "./dist/components/site/SectionIntro.astro",
|
|
147
|
+
"./components/site/PathCard.astro": "./dist/components/site/PathCard.astro",
|
|
148
|
+
"./components/site/TrustCallout.astro": "./dist/components/site/TrustCallout.astro",
|
|
149
|
+
"./components/content/ContentStatusLegend.astro": "./dist/components/content/ContentStatusLegend.astro",
|
|
150
|
+
"./components/starlight": {
|
|
151
|
+
"types": "./dist/components/starlight.d.ts",
|
|
152
|
+
"default": "./dist/components/starlight.js"
|
|
153
|
+
},
|
|
154
|
+
"./tsconfigs/strict": "./dist/tsconfigs/strict.json"
|
|
155
|
+
}
|
|
156
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/*
|
|
2
|
+
How does anchor link placement work?
|
|
3
|
+
|
|
4
|
+
Because anchor links need to placed inline at the end of a heading, but are not children of the
|
|
5
|
+
heading element itself, positioning them to behave in a desirable way is a tiny bit tricky. Here’s
|
|
6
|
+
how we do it.
|
|
7
|
+
|
|
8
|
+
1. We wrap the heading and anchor link in a div and make the heading element inline:
|
|
9
|
+
<div class="sl-heading-wrapper">
|
|
10
|
+
<h2>...</h2><a class="sl-anchor-link">...</a>
|
|
11
|
+
</a>
|
|
12
|
+
|
|
13
|
+
2. We need to avoid the anchor link wrapping onto a new line by itself like this because it looks
|
|
14
|
+
broken:
|
|
15
|
+
|
|
16
|
+
Some heading text
|
|
17
|
+
⛓
|
|
18
|
+
|
|
19
|
+
3. To achieve this we add an area of padding to the end of the heading and move the link over this
|
|
20
|
+
padding using negative margin:
|
|
21
|
+
|
|
22
|
+
padding-inline-end creates space at the end of the line
|
|
23
|
+
↓
|
|
24
|
+
Some heading text[ ]⛓
|
|
25
|
+
|
|
26
|
+
margin-inline-start then pulls the anchor link into that space
|
|
27
|
+
↓
|
|
28
|
+
Some heading text[ ⛓ ]
|
|
29
|
+
|
|
30
|
+
This ensures that when the anchor link wraps, the final word in the heading will wrap with it.
|
|
31
|
+
|
|
32
|
+
*/
|
|
33
|
+
@layer starlight.content {
|
|
34
|
+
/* ======================================================
|
|
35
|
+
WRAPPER
|
|
36
|
+
====================================================== */
|
|
37
|
+
.sl-markdown-content .sl-heading-wrapper {
|
|
38
|
+
/* The size of the SVG icon. */
|
|
39
|
+
--sl-anchor-icon-size: 0.8275em;
|
|
40
|
+
/* The horizontal space between the SVG icon and the end of the heading text. */
|
|
41
|
+
--sl-anchor-icon-gap: 0.25em;
|
|
42
|
+
/* The end of line space required to accommodate the anchor link. */
|
|
43
|
+
--sl-anchor-icon-space: calc(var(--sl-anchor-icon-size) + var(--sl-anchor-icon-gap));
|
|
44
|
+
|
|
45
|
+
line-height: var(--sl-line-height-headings);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* We need to apply the same rule we use for heading spacing to the parent wrapper. */
|
|
49
|
+
.sl-markdown-content
|
|
50
|
+
:not(h1, h2, h3, h4, h5, h6, .sl-heading-wrapper)
|
|
51
|
+
+ :is(.sl-heading-wrapper) {
|
|
52
|
+
margin-top: 1.5em;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* These font sizes are set in `markdown.css` for heading elements, but we need them one level higher on the wrapper. */
|
|
56
|
+
.sl-markdown-content .sl-heading-wrapper.level-h1 {
|
|
57
|
+
font-size: var(--sl-text-h1);
|
|
58
|
+
}
|
|
59
|
+
.sl-markdown-content .sl-heading-wrapper.level-h2 {
|
|
60
|
+
font-size: var(--sl-text-h2);
|
|
61
|
+
}
|
|
62
|
+
.sl-markdown-content .sl-heading-wrapper.level-h3 {
|
|
63
|
+
font-size: var(--sl-text-h3);
|
|
64
|
+
}
|
|
65
|
+
.sl-markdown-content .sl-heading-wrapper.level-h4 {
|
|
66
|
+
font-size: var(--sl-text-h4);
|
|
67
|
+
}
|
|
68
|
+
.sl-markdown-content .sl-heading-wrapper.level-h5 {
|
|
69
|
+
font-size: var(--sl-text-h5);
|
|
70
|
+
}
|
|
71
|
+
.sl-markdown-content .sl-heading-wrapper.level-h6 {
|
|
72
|
+
font-size: var(--sl-text-h6);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/* ======================================================
|
|
76
|
+
HEADING
|
|
77
|
+
====================================================== */
|
|
78
|
+
.sl-markdown-content .sl-heading-wrapper > :first-child {
|
|
79
|
+
display: inline;
|
|
80
|
+
/* Apply end-of-line padding to the heading element. */
|
|
81
|
+
padding-inline-end: var(--sl-anchor-icon-space);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* ======================================================
|
|
85
|
+
LINK
|
|
86
|
+
====================================================== */
|
|
87
|
+
.sl-markdown-content .sl-anchor-link {
|
|
88
|
+
position: relative;
|
|
89
|
+
/* Move the anchor link over the heading element’s end-of-line padding. */
|
|
90
|
+
margin-inline-start: calc(-1 * var(--sl-anchor-icon-size));
|
|
91
|
+
/* Prevent double or triple clicks from potentially selecting the anchor link a11y text. */
|
|
92
|
+
-webkit-user-select: none;
|
|
93
|
+
user-select: none;
|
|
94
|
+
/* Prevent double clicks on the last word (or single word) of a heading to include an extra new
|
|
95
|
+
line in Chrome and Safari. */
|
|
96
|
+
display: inline-flex;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/* Increase clickable area for anchor links with a pseudo element that doesn’t impact layout. */
|
|
100
|
+
.sl-markdown-content .sl-anchor-link::after {
|
|
101
|
+
content: '';
|
|
102
|
+
position: absolute;
|
|
103
|
+
/* While most icon spacing is done with `em` to be relative to the heading font-size, increasing
|
|
104
|
+
the touch area is most important for smaller headings like h5/h6, so we use absolute units,
|
|
105
|
+
which have a diminishing impact at larger font-sizes. */
|
|
106
|
+
inset: -0.25rem -0.5rem;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/* Size and position the SVG icon inside the link. */
|
|
110
|
+
.sl-markdown-content .sl-anchor-icon > svg {
|
|
111
|
+
display: inline;
|
|
112
|
+
width: var(--sl-anchor-icon-size);
|
|
113
|
+
/* Center the link icon SVG vertically in the line. */
|
|
114
|
+
vertical-align: top;
|
|
115
|
+
transform: translateY(
|
|
116
|
+
calc((var(--sl-line-height-headings) * 1em - var(--sl-anchor-icon-size)) / 2)
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/* On devices with hover capability, hide the anchor link icons and show only show them when focused
|
|
121
|
+
or when the heading is hovered. */
|
|
122
|
+
@media (hover: hover) {
|
|
123
|
+
.sl-markdown-content .sl-anchor-link {
|
|
124
|
+
opacity: 0;
|
|
125
|
+
}
|
|
126
|
+
.sl-markdown-content .sl-anchor-link:focus,
|
|
127
|
+
.sl-markdown-content .sl-heading-wrapper:hover .sl-anchor-link {
|
|
128
|
+
opacity: 1;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
name: Deploy Treeseed Site
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- staging
|
|
7
|
+
- main
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
deploy:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
permissions:
|
|
14
|
+
contents: read
|
|
15
|
+
deployments: write
|
|
16
|
+
if: github.ref_name == 'staging' || github.ref_name == 'main'
|
|
17
|
+
__WORKING_DIRECTORY_BLOCK__ environment: ${{ github.ref_name == 'main' && 'production' || 'staging' }}
|
|
18
|
+
env:
|
|
19
|
+
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
20
|
+
TREESEED_FORM_TOKEN_SECRET: ${{ secrets.TREESEED_FORM_TOKEN_SECRET }}
|
|
21
|
+
TREESEED_PUBLIC_TURNSTILE_SITE_KEY: ${{ secrets.TREESEED_PUBLIC_TURNSTILE_SITE_KEY }}
|
|
22
|
+
TREESEED_TURNSTILE_SECRET_KEY: ${{ secrets.TREESEED_TURNSTILE_SECRET_KEY }}
|
|
23
|
+
TREESEED_SMTP_HOST: ${{ secrets.TREESEED_SMTP_HOST }}
|
|
24
|
+
TREESEED_SMTP_PORT: ${{ secrets.TREESEED_SMTP_PORT }}
|
|
25
|
+
TREESEED_SMTP_USERNAME: ${{ secrets.TREESEED_SMTP_USERNAME }}
|
|
26
|
+
TREESEED_SMTP_PASSWORD: ${{ secrets.TREESEED_SMTP_PASSWORD }}
|
|
27
|
+
TREESEED_SMTP_FROM: ${{ secrets.TREESEED_SMTP_FROM }}
|
|
28
|
+
TREESEED_SMTP_REPLY_TO: ${{ secrets.TREESEED_SMTP_REPLY_TO }}
|
|
29
|
+
steps:
|
|
30
|
+
- name: Checkout
|
|
31
|
+
uses: actions/checkout@v4
|
|
32
|
+
|
|
33
|
+
- name: Setup Node
|
|
34
|
+
uses: actions/setup-node@v4
|
|
35
|
+
with:
|
|
36
|
+
node-version: 20
|
|
37
|
+
cache: npm
|
|
38
|
+
cache-dependency-path: __CACHE_DEPENDENCY_PATH__
|
|
39
|
+
|
|
40
|
+
- name: Install dependencies
|
|
41
|
+
run: npm ci
|
|
42
|
+
|
|
43
|
+
- name: Check site
|
|
44
|
+
run: npm run check
|
|
45
|
+
|
|
46
|
+
- name: Deploy site
|
|
47
|
+
run: npm run deploy -- --environment ${{ github.ref_name == 'main' && 'prod' || 'staging' }}
|
package/utils/git.ts
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git module to be used from the dev server and from the integration.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { basename, dirname, relative, resolve } from 'node:path';
|
|
6
|
+
import { realpathSync } from 'node:fs';
|
|
7
|
+
import { spawnSync } from 'node:child_process';
|
|
8
|
+
|
|
9
|
+
export type GitAPI = {
|
|
10
|
+
getNewestCommitDate: (file: string) => Date;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const makeAPI = (directory: string): GitAPI => {
|
|
14
|
+
return {
|
|
15
|
+
getNewestCommitDate: (file) => getNewestCommitDate(resolve(directory, file)),
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export function getNewestCommitDate(file: string): Date {
|
|
20
|
+
const result = spawnSync('git', ['log', '--format=%ct', '--max-count=1', basename(file)], {
|
|
21
|
+
cwd: dirname(file),
|
|
22
|
+
encoding: 'utf-8',
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
if (result.error) {
|
|
26
|
+
throw new Error(`Failed to retrieve the git history for file "${file}"`);
|
|
27
|
+
}
|
|
28
|
+
const output = result.stdout.trim();
|
|
29
|
+
const regex = /^(?<timestamp>\d+)$/;
|
|
30
|
+
const match = output.match(regex);
|
|
31
|
+
|
|
32
|
+
if (!match?.groups?.timestamp) {
|
|
33
|
+
throw new Error(`Failed to validate the timestamp for file "${file}"`);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const timestamp = Number(match.groups.timestamp);
|
|
37
|
+
const date = new Date(timestamp * 1000);
|
|
38
|
+
return date;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function getRepoRoot(directory: string): string {
|
|
42
|
+
const result = spawnSync('git', ['rev-parse', '--show-toplevel'], {
|
|
43
|
+
cwd: directory,
|
|
44
|
+
encoding: 'utf-8',
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
if (result.error) {
|
|
48
|
+
return directory;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
try {
|
|
52
|
+
return realpathSync(result.stdout.trim());
|
|
53
|
+
} catch {
|
|
54
|
+
return directory;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function getAllNewestCommitDate(rootPath: string, docsPath: string): [string, number][] {
|
|
59
|
+
const repoRoot = getRepoRoot(docsPath);
|
|
60
|
+
|
|
61
|
+
const gitLog = spawnSync(
|
|
62
|
+
'git',
|
|
63
|
+
[
|
|
64
|
+
'log',
|
|
65
|
+
// Format each history entry as t:<seconds since epoch>
|
|
66
|
+
'--format=t:%ct',
|
|
67
|
+
// In each entry include the name and status for each modified file
|
|
68
|
+
'--name-status',
|
|
69
|
+
'--',
|
|
70
|
+
docsPath,
|
|
71
|
+
],
|
|
72
|
+
{
|
|
73
|
+
cwd: repoRoot,
|
|
74
|
+
encoding: 'utf-8',
|
|
75
|
+
// The default `maxBuffer` for `spawnSync` is 1024 * 1024 bytes, a.k.a 1 MB. In big projects,
|
|
76
|
+
// the full git history can be larger than this, so we increase this to ~10 MB. For example,
|
|
77
|
+
// Cloudflare passed 1 MB with ~4,800 pages and ~17,000 commits. If we get reports of others
|
|
78
|
+
// hitting ENOBUFS errors here in the future, we may want to switch to streaming the git log
|
|
79
|
+
// with `spawn` instead.
|
|
80
|
+
// See https://github.com/withastro/starlight/issues/3154
|
|
81
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
82
|
+
}
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
if (gitLog.error) {
|
|
86
|
+
return [];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
let runningDate = Date.now();
|
|
90
|
+
const latestDates = new Map<string, number>();
|
|
91
|
+
|
|
92
|
+
for (const logLine of gitLog.stdout.split('\n')) {
|
|
93
|
+
if (logLine.startsWith('t:')) {
|
|
94
|
+
// t:<seconds since epoch>
|
|
95
|
+
runningDate = Number.parseInt(logLine.slice(2)) * 1000;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// - Added files take the format `A\t<file>`
|
|
99
|
+
// - Modified files take the format `M\t<file>`
|
|
100
|
+
// - Deleted files take the format `D\t<file>`
|
|
101
|
+
// - Renamed files take the format `R<count>\t<old>\t<new>`
|
|
102
|
+
// - Copied files take the format `C<count>\t<old>\t<new>`
|
|
103
|
+
// The name of the file as of the commit being processed is always
|
|
104
|
+
// the last part of the log line.
|
|
105
|
+
const tabSplit = logLine.lastIndexOf('\t');
|
|
106
|
+
if (tabSplit === -1) continue;
|
|
107
|
+
const fileName = logLine.slice(tabSplit + 1);
|
|
108
|
+
|
|
109
|
+
const currentLatest = latestDates.get(fileName) || 0;
|
|
110
|
+
latestDates.set(fileName, Math.max(currentLatest, runningDate));
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return Array.from(latestDates.entries()).map(([file, date]) => {
|
|
114
|
+
const fileFullPath = resolve(repoRoot, file);
|
|
115
|
+
let fileInDirectory = relative(rootPath, fileFullPath);
|
|
116
|
+
// Format path to unix style path.
|
|
117
|
+
fileInDirectory = fileInDirectory?.replace(/\\/g, '/');
|
|
118
|
+
|
|
119
|
+
return [fileInDirectory, date];
|
|
120
|
+
});
|
|
121
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git module to be used on production build results.
|
|
3
|
+
* The API is based on inlined git information.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { GitAPI, getAllNewestCommitDate } from './git';
|
|
7
|
+
|
|
8
|
+
type InlinedData = ReturnType<typeof getAllNewestCommitDate>;
|
|
9
|
+
|
|
10
|
+
export const makeAPI = (data: InlinedData): GitAPI => {
|
|
11
|
+
const trackedDocsFiles = new Map(data);
|
|
12
|
+
|
|
13
|
+
return {
|
|
14
|
+
getNewestCommitDate: (file) => {
|
|
15
|
+
const timestamp = trackedDocsFiles.get(file);
|
|
16
|
+
if (!timestamp) throw new Error(`Failed to retrieve the git history for file "${file}"`);
|
|
17
|
+
return new Date(timestamp);
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
};
|