@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.
Files changed (384) hide show
  1. package/README.md +145 -0
  2. package/dist/agents/index.js +5 -0
  3. package/dist/agents/registry-helper.js +14 -0
  4. package/dist/agents/registry.js +88 -0
  5. package/dist/components/DevWatchReload.astro +45 -0
  6. package/dist/components/SiteTitle.astro +51 -0
  7. package/dist/components/content/ContentStatusLegend.astro +18 -0
  8. package/dist/components/content/StatusBadge.astro +11 -0
  9. package/dist/components/docs/BookFontControls.astro +180 -0
  10. package/dist/components/docs/DesktopSidebarToggle.astro +88 -0
  11. package/dist/components/docs/DownloadBook.astro +34 -0
  12. package/dist/components/docs/Footer.astro +196 -0
  13. package/dist/components/docs/Header.astro +150 -0
  14. package/dist/components/docs/PageFrame.astro +260 -0
  15. package/dist/components/docs/PageSidebar.astro +63 -0
  16. package/dist/components/docs/PageTitle.astro +39 -0
  17. package/dist/components/docs/Sidebar.astro +41 -0
  18. package/dist/components/docs/ThemeSelect.astro +3 -0
  19. package/dist/components/forms/ContactForm.astro +234 -0
  20. package/dist/components/forms/FooterSubscribeForm.astro +189 -0
  21. package/dist/components/site/BookList.astro +27 -0
  22. package/dist/components/site/CTASection.astro +24 -0
  23. package/dist/components/site/ChronicleList.astro +33 -0
  24. package/dist/components/site/Hero.astro +18 -0
  25. package/dist/components/site/NotesList.astro +18 -0
  26. package/dist/components/site/PathCard.astro +16 -0
  27. package/dist/components/site/ProfileList.astro +30 -0
  28. package/dist/components/site/SectionIntro.astro +9 -0
  29. package/dist/components/site/StageBanner.astro +8 -0
  30. package/dist/components/site/TrustCallout.astro +9 -0
  31. package/dist/components/starlight.js +6 -0
  32. package/dist/config.js +8 -0
  33. package/dist/content-config.js +9 -0
  34. package/dist/content.js +230 -0
  35. package/dist/contracts.d.ts +130 -0
  36. package/dist/contracts.js +0 -0
  37. package/dist/deploy/config.d.ts +4 -0
  38. package/dist/deploy/config.js +154 -0
  39. package/dist/deploy/runtime.js +77 -0
  40. package/dist/env.yaml +322 -0
  41. package/dist/environment.d.ts +130 -0
  42. package/dist/environment.js +324 -0
  43. package/dist/index.js +81 -0
  44. package/dist/layouts/AuthoredEntryLayout.astro +87 -0
  45. package/dist/layouts/BookLayout.astro +35 -0
  46. package/dist/layouts/BridgeLayout.astro +11 -0
  47. package/dist/layouts/ContentLayout.astro +24 -0
  48. package/dist/layouts/MainLayout.astro +203 -0
  49. package/dist/layouts/NoteLayout.astro +26 -0
  50. package/dist/layouts/ProfileLayout.astro +81 -0
  51. package/dist/middleware/starlightRouteData.js +45 -0
  52. package/dist/pages/404.astro +29 -0
  53. package/dist/pages/[slug].astro +30 -0
  54. package/dist/pages/agents/[slug].astro +29 -0
  55. package/dist/pages/agents/index.astro +27 -0
  56. package/dist/pages/api/form/submit.js +14 -0
  57. package/dist/pages/books/[slug].astro +19 -0
  58. package/dist/pages/books/index.astro +28 -0
  59. package/dist/pages/contact.astro +27 -0
  60. package/dist/pages/feed.xml.js +34 -0
  61. package/dist/pages/index.astro +290 -0
  62. package/dist/pages/notes/[slug].astro +19 -0
  63. package/dist/pages/notes/index.astro +21 -0
  64. package/dist/pages/objectives/[slug].astro +31 -0
  65. package/dist/pages/objectives/index.astro +30 -0
  66. package/dist/pages/people/[slug].astro +29 -0
  67. package/dist/pages/people/index.astro +28 -0
  68. package/dist/pages/questions/[slug].astro +31 -0
  69. package/dist/pages/questions/index.astro +30 -0
  70. package/dist/plugin-default.js +4 -0
  71. package/dist/plugins/builtin/default-plugin.d.ts +21 -0
  72. package/dist/plugins/builtin/default-plugin.js +32 -0
  73. package/dist/plugins/constants.d.ts +21 -0
  74. package/dist/plugins/constants.js +28 -0
  75. package/dist/plugins/plugin.d.ts +42 -0
  76. package/dist/plugins/plugin.js +6 -0
  77. package/dist/plugins/runtime.d.ts +31 -0
  78. package/dist/plugins/runtime.js +120 -0
  79. package/dist/scripts/aggregate-book.js +112 -0
  80. package/dist/scripts/assert-release-tag-version.js +21 -0
  81. package/dist/scripts/build-dist.js +384 -0
  82. package/dist/scripts/build-tenant-worker.js +36 -0
  83. package/dist/scripts/package-tools.js +88 -0
  84. package/dist/scripts/patch-starlight-content-path.js +172 -0
  85. package/dist/scripts/paths.js +11 -0
  86. package/dist/scripts/publish-package.js +20 -0
  87. package/dist/scripts/release-verify.js +52 -0
  88. package/dist/scripts/run-fixture-astro-command.js +21 -0
  89. package/dist/scripts/tenant-astro-command.js +3 -0
  90. package/dist/scripts/tenant-build.js +16 -0
  91. package/dist/scripts/tenant-check.js +7 -0
  92. package/dist/scripts/test-smoke.js +105 -0
  93. package/dist/server.js +53 -0
  94. package/dist/site-resources.d.ts +29 -0
  95. package/dist/site-resources.js +127 -0
  96. package/dist/site.js +313 -0
  97. package/dist/styles/global.css +683 -0
  98. package/dist/styles/prose.css +89 -0
  99. package/dist/styles/tokens.css +24 -0
  100. package/dist/tenant/bridge.js +5 -0
  101. package/dist/tenant/config.d.ts +9 -0
  102. package/dist/tenant/config.js +124 -0
  103. package/dist/tenant/runtime-config.js +20 -0
  104. package/dist/tsconfigs/strict.json +3 -0
  105. package/dist/types/agents.d.ts +1 -0
  106. package/dist/types/agents.js +1 -0
  107. package/dist/types/astro-build.d.js +0 -0
  108. package/dist/types/cloudflare-sockets.d.js +0 -0
  109. package/dist/types/cloudflare.d.ts +1 -0
  110. package/dist/types/cloudflare.js +1 -0
  111. package/dist/types/forms.js +4 -0
  112. package/dist/utils/agents/adapters/execution.js +90 -0
  113. package/dist/utils/agents/adapters/mutations.js +30 -0
  114. package/dist/utils/agents/adapters/notification.js +16 -0
  115. package/dist/utils/agents/adapters/repository.js +61 -0
  116. package/dist/utils/agents/adapters/research.js +25 -0
  117. package/dist/utils/agents/adapters/verification.js +62 -0
  118. package/dist/utils/agents/cli-tools.js +5 -0
  119. package/dist/utils/agents/contracts/messages.d.ts +88 -0
  120. package/dist/utils/agents/contracts/messages.js +138 -0
  121. package/dist/utils/agents/contracts/run.d.ts +20 -0
  122. package/dist/utils/agents/contracts/run.js +0 -0
  123. package/dist/utils/agents/runtime-types.d.ts +117 -0
  124. package/dist/utils/agents/runtime-types.js +4 -0
  125. package/dist/utils/books-data.js +82 -0
  126. package/dist/utils/content-status.js +38 -0
  127. package/dist/utils/forms/config.js +87 -0
  128. package/dist/utils/forms/constants.js +27 -0
  129. package/dist/utils/forms/contact-submissions-local.js +19 -0
  130. package/dist/utils/forms/contact-submissions.js +72 -0
  131. package/dist/utils/forms/crypto.js +64 -0
  132. package/dist/utils/forms/guard.js +76 -0
  133. package/dist/utils/forms/http.js +51 -0
  134. package/dist/utils/forms/provider-core.js +88 -0
  135. package/dist/utils/forms/routing-core.js +7 -0
  136. package/dist/utils/forms/routing.js +13 -0
  137. package/dist/utils/forms/runtime-core.js +17 -0
  138. package/dist/utils/forms/runtime.js +27 -0
  139. package/dist/utils/forms/service-core.js +256 -0
  140. package/dist/utils/forms/service.js +55 -0
  141. package/dist/utils/forms/session.js +57 -0
  142. package/dist/utils/forms/smtp-cloudflare.js +107 -0
  143. package/dist/utils/forms/smtp-node.js +27 -0
  144. package/dist/utils/forms/smtp.js +10 -0
  145. package/dist/utils/forms/subscribers-local.js +21 -0
  146. package/dist/utils/forms/subscribers.js +53 -0
  147. package/dist/utils/forms/turnstile.js +31 -0
  148. package/dist/utils/forms/validation.js +58 -0
  149. package/dist/utils/hub-content.js +28 -0
  150. package/dist/utils/plugin-runtime.js +158 -0
  151. package/dist/utils/routes.js +17 -0
  152. package/dist/utils/seo.js +4 -0
  153. package/dist/utils/site-config-schema.js +282 -0
  154. package/dist/utils/site-config.js +122 -0
  155. package/dist/utils/starlight-nav.js +62 -0
  156. package/dist/utils/theme.js +49 -0
  157. package/dist/vendor/starlight/components/AnchorHeading.astro +53 -0
  158. package/dist/vendor/starlight/components/Banner.astro +23 -0
  159. package/dist/vendor/starlight/components/ContentNotice.astro +33 -0
  160. package/dist/vendor/starlight/components/ContentPanel.astro +27 -0
  161. package/dist/vendor/starlight/components/DraftContentNotice.astro +5 -0
  162. package/dist/vendor/starlight/components/EditLink.astro +28 -0
  163. package/dist/vendor/starlight/components/FallbackContentNotice.astro +5 -0
  164. package/dist/vendor/starlight/components/Footer.astro +61 -0
  165. package/dist/vendor/starlight/components/Head.astro +5 -0
  166. package/dist/vendor/starlight/components/Header.astro +94 -0
  167. package/dist/vendor/starlight/components/Hero.astro +143 -0
  168. package/dist/vendor/starlight/components/Icons.js +121 -0
  169. package/dist/vendor/starlight/components/LanguageSelect.astro +57 -0
  170. package/dist/vendor/starlight/components/LastUpdated.astro +14 -0
  171. package/dist/vendor/starlight/components/MarkdownContent.astro +5 -0
  172. package/dist/vendor/starlight/components/MobileMenuFooter.astro +35 -0
  173. package/dist/vendor/starlight/components/MobileMenuToggle.astro +107 -0
  174. package/dist/vendor/starlight/components/MobileTableOfContents.astro +151 -0
  175. package/dist/vendor/starlight/components/Page.astro +126 -0
  176. package/dist/vendor/starlight/components/PageFrame.astro +97 -0
  177. package/dist/vendor/starlight/components/PageSidebar.astro +59 -0
  178. package/dist/vendor/starlight/components/PageTitle.astro +17 -0
  179. package/dist/vendor/starlight/components/Pagination.astro +79 -0
  180. package/dist/vendor/starlight/components/Search.astro +488 -0
  181. package/dist/vendor/starlight/components/Select.astro +99 -0
  182. package/dist/vendor/starlight/components/Sidebar.astro +15 -0
  183. package/dist/vendor/starlight/components/SidebarPersistState.js +43 -0
  184. package/dist/vendor/starlight/components/SidebarPersister.astro +78 -0
  185. package/dist/vendor/starlight/components/SidebarRestorePoint.astro +12 -0
  186. package/dist/vendor/starlight/components/SidebarSublist.astro +154 -0
  187. package/dist/vendor/starlight/components/SiteTitle.astro +59 -0
  188. package/dist/vendor/starlight/components/SkipLink.astro +26 -0
  189. package/dist/vendor/starlight/components/SocialIcons.astro +32 -0
  190. package/dist/vendor/starlight/components/StarlightPage.astro +17 -0
  191. package/dist/vendor/starlight/components/TableOfContents/TableOfContentsList.astro +79 -0
  192. package/dist/vendor/starlight/components/TableOfContents/starlight-toc.js +93 -0
  193. package/dist/vendor/starlight/components/TableOfContents.astro +18 -0
  194. package/dist/vendor/starlight/components/ThemeProvider.astro +38 -0
  195. package/dist/vendor/starlight/components/ThemeSelect.astro +73 -0
  196. package/dist/vendor/starlight/components/TwoColumnContent.astro +54 -0
  197. package/dist/vendor/starlight/components.js +26 -0
  198. package/dist/vendor/starlight/constants.js +4 -0
  199. package/dist/vendor/starlight/expressive-code.d.js +1 -0
  200. package/dist/vendor/starlight/global.d.js +0 -0
  201. package/dist/vendor/starlight/i18n.d.js +1 -0
  202. package/dist/vendor/starlight/index.js +119 -0
  203. package/dist/vendor/starlight/integrations/asides-error.js +12 -0
  204. package/dist/vendor/starlight/integrations/asides.js +179 -0
  205. package/dist/vendor/starlight/integrations/code-rtl-support.js +21 -0
  206. package/dist/vendor/starlight/integrations/expressive-code/hast.d.js +1 -0
  207. package/dist/vendor/starlight/integrations/expressive-code/index.js +63 -0
  208. package/dist/vendor/starlight/integrations/expressive-code/preprocessor.js +92 -0
  209. package/dist/vendor/starlight/integrations/expressive-code/themes/night-owl-dark.jsonc +1796 -0
  210. package/dist/vendor/starlight/integrations/expressive-code/themes/night-owl-dark.jsonc.js +1 -0
  211. package/dist/vendor/starlight/integrations/expressive-code/themes/night-owl-light.jsonc +1695 -0
  212. package/dist/vendor/starlight/integrations/expressive-code/themes/night-owl-light.jsonc.js +1 -0
  213. package/dist/vendor/starlight/integrations/expressive-code/theming.js +62 -0
  214. package/dist/vendor/starlight/integrations/expressive-code/translations.js +29 -0
  215. package/dist/vendor/starlight/integrations/heading-links.js +61 -0
  216. package/dist/vendor/starlight/integrations/pagefind.js +43 -0
  217. package/dist/vendor/starlight/integrations/remark-rehype.js +68 -0
  218. package/dist/vendor/starlight/integrations/shared/absolutePathToLang.js +15 -0
  219. package/dist/vendor/starlight/integrations/shared/localeToLang.js +9 -0
  220. package/dist/vendor/starlight/integrations/shared/slugToLocale.js +10 -0
  221. package/dist/vendor/starlight/integrations/sitemap.js +20 -0
  222. package/dist/vendor/starlight/integrations/virtual-user-config.js +110 -0
  223. package/dist/vendor/starlight/integrations/vite-layer-order.js +42 -0
  224. package/dist/vendor/starlight/internal.js +6 -0
  225. package/dist/vendor/starlight/loaders.js +36 -0
  226. package/dist/vendor/starlight/locals.d.js +0 -0
  227. package/dist/vendor/starlight/locals.js +30 -0
  228. package/dist/vendor/starlight/package.json +231 -0
  229. package/dist/vendor/starlight/package.json.js +248 -0
  230. package/dist/vendor/starlight/props.js +0 -0
  231. package/dist/vendor/starlight/route-data.js +6 -0
  232. package/dist/vendor/starlight/routes/common.astro +23 -0
  233. package/dist/vendor/starlight/routes/ssr/404.astro +7 -0
  234. package/dist/vendor/starlight/routes/ssr/index.astro +14 -0
  235. package/dist/vendor/starlight/routes/static/404.astro +7 -0
  236. package/dist/vendor/starlight/routes/static/index.astro +12 -0
  237. package/dist/vendor/starlight/schema.js +102 -0
  238. package/dist/vendor/starlight/schemas/badge.js +26 -0
  239. package/dist/vendor/starlight/schemas/components.js +235 -0
  240. package/dist/vendor/starlight/schemas/expressiveCode.js +12 -0
  241. package/dist/vendor/starlight/schemas/favicon.js +33 -0
  242. package/dist/vendor/starlight/schemas/head.js +32 -0
  243. package/dist/vendor/starlight/schemas/hero.js +57 -0
  244. package/dist/vendor/starlight/schemas/i18n.js +101 -0
  245. package/dist/vendor/starlight/schemas/icon.js +7 -0
  246. package/dist/vendor/starlight/schemas/logo.js +24 -0
  247. package/dist/vendor/starlight/schemas/pagefind.js +108 -0
  248. package/dist/vendor/starlight/schemas/prevNextLink.js +14 -0
  249. package/dist/vendor/starlight/schemas/sidebar.js +80 -0
  250. package/dist/vendor/starlight/schemas/site-title.js +19 -0
  251. package/dist/vendor/starlight/schemas/social.js +19 -0
  252. package/dist/vendor/starlight/schemas/tableOfContents.js +16 -0
  253. package/dist/vendor/starlight/style/anchor-links.css +131 -0
  254. package/dist/vendor/starlight/style/asides.css +51 -0
  255. package/dist/vendor/starlight/style/layers.css +1 -0
  256. package/dist/vendor/starlight/style/markdown.css +253 -0
  257. package/dist/vendor/starlight/style/print.css +175 -0
  258. package/dist/vendor/starlight/style/props.css +188 -0
  259. package/dist/vendor/starlight/style/reset.css +52 -0
  260. package/dist/vendor/starlight/style/util.css +63 -0
  261. package/dist/vendor/starlight/translations/ar.json +30 -0
  262. package/dist/vendor/starlight/translations/ar.json.js +32 -0
  263. package/dist/vendor/starlight/translations/ca.json +43 -0
  264. package/dist/vendor/starlight/translations/ca.json.js +45 -0
  265. package/dist/vendor/starlight/translations/cs.json +43 -0
  266. package/dist/vendor/starlight/translations/cs.json.js +45 -0
  267. package/dist/vendor/starlight/translations/da.json +30 -0
  268. package/dist/vendor/starlight/translations/da.json.js +32 -0
  269. package/dist/vendor/starlight/translations/de.json +30 -0
  270. package/dist/vendor/starlight/translations/de.json.js +32 -0
  271. package/dist/vendor/starlight/translations/el.json +30 -0
  272. package/dist/vendor/starlight/translations/el.json.js +32 -0
  273. package/dist/vendor/starlight/translations/en.json +30 -0
  274. package/dist/vendor/starlight/translations/en.json.js +32 -0
  275. package/dist/vendor/starlight/translations/es.json +43 -0
  276. package/dist/vendor/starlight/translations/es.json.js +45 -0
  277. package/dist/vendor/starlight/translations/fa.json +30 -0
  278. package/dist/vendor/starlight/translations/fa.json.js +32 -0
  279. package/dist/vendor/starlight/translations/fi.json +30 -0
  280. package/dist/vendor/starlight/translations/fi.json.js +32 -0
  281. package/dist/vendor/starlight/translations/fr.json +33 -0
  282. package/dist/vendor/starlight/translations/fr.json.js +35 -0
  283. package/dist/vendor/starlight/translations/gl.json +43 -0
  284. package/dist/vendor/starlight/translations/gl.json.js +45 -0
  285. package/dist/vendor/starlight/translations/he.json +30 -0
  286. package/dist/vendor/starlight/translations/he.json.js +32 -0
  287. package/dist/vendor/starlight/translations/hi.json +30 -0
  288. package/dist/vendor/starlight/translations/hi.json.js +32 -0
  289. package/dist/vendor/starlight/translations/hu.json +43 -0
  290. package/dist/vendor/starlight/translations/hu.json.js +45 -0
  291. package/dist/vendor/starlight/translations/id.json +30 -0
  292. package/dist/vendor/starlight/translations/id.json.js +32 -0
  293. package/dist/vendor/starlight/translations/index.js +77 -0
  294. package/dist/vendor/starlight/translations/it.json +30 -0
  295. package/dist/vendor/starlight/translations/it.json.js +32 -0
  296. package/dist/vendor/starlight/translations/ja.json +30 -0
  297. package/dist/vendor/starlight/translations/ja.json.js +32 -0
  298. package/dist/vendor/starlight/translations/ko.json +30 -0
  299. package/dist/vendor/starlight/translations/ko.json.js +32 -0
  300. package/dist/vendor/starlight/translations/lv.json +30 -0
  301. package/dist/vendor/starlight/translations/lv.json.js +32 -0
  302. package/dist/vendor/starlight/translations/nb.json +30 -0
  303. package/dist/vendor/starlight/translations/nb.json.js +32 -0
  304. package/dist/vendor/starlight/translations/nl.json +30 -0
  305. package/dist/vendor/starlight/translations/nl.json.js +32 -0
  306. package/dist/vendor/starlight/translations/pl.json +33 -0
  307. package/dist/vendor/starlight/translations/pl.json.js +35 -0
  308. package/dist/vendor/starlight/translations/pt.json +30 -0
  309. package/dist/vendor/starlight/translations/pt.json.js +32 -0
  310. package/dist/vendor/starlight/translations/ro.json +30 -0
  311. package/dist/vendor/starlight/translations/ro.json.js +32 -0
  312. package/dist/vendor/starlight/translations/ru.json +33 -0
  313. package/dist/vendor/starlight/translations/ru.json.js +35 -0
  314. package/dist/vendor/starlight/translations/sk.json +30 -0
  315. package/dist/vendor/starlight/translations/sk.json.js +32 -0
  316. package/dist/vendor/starlight/translations/sv.json +30 -0
  317. package/dist/vendor/starlight/translations/sv.json.js +32 -0
  318. package/dist/vendor/starlight/translations/th.json +30 -0
  319. package/dist/vendor/starlight/translations/th.json.js +32 -0
  320. package/dist/vendor/starlight/translations/tr.json +30 -0
  321. package/dist/vendor/starlight/translations/tr.json.js +32 -0
  322. package/dist/vendor/starlight/translations/uk.json +30 -0
  323. package/dist/vendor/starlight/translations/uk.json.js +32 -0
  324. package/dist/vendor/starlight/translations/vi.json +30 -0
  325. package/dist/vendor/starlight/translations/vi.json.js +32 -0
  326. package/dist/vendor/starlight/translations/zh-CN.json +30 -0
  327. package/dist/vendor/starlight/translations/zh-CN.json.js +32 -0
  328. package/dist/vendor/starlight/translations/zh-TW.json +30 -0
  329. package/dist/vendor/starlight/translations/zh-TW.json.js +32 -0
  330. package/dist/vendor/starlight/types.js +0 -0
  331. package/dist/vendor/starlight/user-components/Aside.astro +40 -0
  332. package/dist/vendor/starlight/user-components/Badge.astro +148 -0
  333. package/dist/vendor/starlight/user-components/Card.astro +68 -0
  334. package/dist/vendor/starlight/user-components/CardGrid.astro +38 -0
  335. package/dist/vendor/starlight/user-components/FileTree.astro +137 -0
  336. package/dist/vendor/starlight/user-components/Icon.astro +42 -0
  337. package/dist/vendor/starlight/user-components/LinkButton.astro +78 -0
  338. package/dist/vendor/starlight/user-components/LinkCard.astro +78 -0
  339. package/dist/vendor/starlight/user-components/Steps.astro +90 -0
  340. package/dist/vendor/starlight/user-components/TabItem.astro +19 -0
  341. package/dist/vendor/starlight/user-components/Tabs.astro +268 -0
  342. package/dist/vendor/starlight/user-components/file-tree-icons.js +608 -0
  343. package/dist/vendor/starlight/user-components/rehype-file-tree.js +160 -0
  344. package/dist/vendor/starlight/user-components/rehype-steps.js +53 -0
  345. package/dist/vendor/starlight/user-components/rehype-tabs.js +73 -0
  346. package/dist/vendor/starlight/utils/base.js +14 -0
  347. package/dist/vendor/starlight/utils/canonical.js +13 -0
  348. package/dist/vendor/starlight/utils/collection-fs.js +13 -0
  349. package/dist/vendor/starlight/utils/collection.js +16 -0
  350. package/dist/vendor/starlight/utils/createPathFormatter.js +39 -0
  351. package/dist/vendor/starlight/utils/createTranslationSystem.js +60 -0
  352. package/dist/vendor/starlight/utils/error-map.js +110 -0
  353. package/dist/vendor/starlight/utils/format-path.js +9 -0
  354. package/dist/vendor/starlight/utils/generateToC.js +18 -0
  355. package/dist/vendor/starlight/utils/git.js +92 -0
  356. package/dist/vendor/starlight/utils/gitInlined.js +13 -0
  357. package/dist/vendor/starlight/utils/head.js +156 -0
  358. package/dist/vendor/starlight/utils/i18n.js +121 -0
  359. package/dist/vendor/starlight/utils/localizedUrl.js +37 -0
  360. package/dist/vendor/starlight/utils/navigation.js +320 -0
  361. package/dist/vendor/starlight/utils/path.js +52 -0
  362. package/dist/vendor/starlight/utils/plugins.js +355 -0
  363. package/dist/vendor/starlight/utils/routing/data.js +116 -0
  364. package/dist/vendor/starlight/utils/routing/index.js +107 -0
  365. package/dist/vendor/starlight/utils/routing/middleware.js +40 -0
  366. package/dist/vendor/starlight/utils/routing/types.js +0 -0
  367. package/dist/vendor/starlight/utils/routing.js +1 -0
  368. package/dist/vendor/starlight/utils/slugs.js +70 -0
  369. package/dist/vendor/starlight/utils/starlight-page.js +123 -0
  370. package/dist/vendor/starlight/utils/translations-fs.js +31 -0
  371. package/dist/vendor/starlight/utils/translations.js +31 -0
  372. package/dist/vendor/starlight/utils/types.js +0 -0
  373. package/dist/vendor/starlight/utils/url.js +5 -0
  374. package/dist/vendor/starlight/utils/user-config.js +255 -0
  375. package/dist/vendor/starlight/utils/validateLogoImports.js +22 -0
  376. package/dist/vendor/starlight/virtual-internal.d.js +0 -0
  377. package/dist/vendor/starlight/virtual.d.js +0 -0
  378. package/dist/worker/forms-worker.js +141 -0
  379. package/package.json +156 -0
  380. package/style/anchor-links.css +131 -0
  381. package/templates/github/deploy.workflow.yml +47 -0
  382. package/tsconfigs/strict.json +3 -0
  383. package/utils/git.ts +121 -0
  384. package/utils/gitInlined.ts +20 -0
@@ -0,0 +1,160 @@
1
+ import { AstroError } from "astro/errors";
2
+ import { h, s } from "hastscript";
3
+ import { select } from "hast-util-select";
4
+ import { fromHtml } from "hast-util-from-html";
5
+ import { toString } from "hast-util-to-string";
6
+ import { rehype } from "rehype";
7
+ import { CONTINUE, SKIP, visit } from "unist-util-visit";
8
+ import { Icons } from "../components/Icons.js";
9
+ import { definitions } from "./file-tree-icons.js";
10
+ const folderIcon = makeSVGIcon(Icons["seti:folder"]);
11
+ const defaultFileIcon = makeSVGIcon(Icons["seti:default"]);
12
+ function processFileTree(html, directoryLabel) {
13
+ const file = fileTreeProcessor.processSync({ data: { directoryLabel }, value: html });
14
+ return file.toString();
15
+ }
16
+ const fileTreeProcessor = rehype().data("settings", { fragment: true }).use(function fileTree() {
17
+ return (tree, file) => {
18
+ const { directoryLabel } = file.data;
19
+ validateFileTree(tree);
20
+ visit(tree, "element", (node) => {
21
+ node.children = node.children.filter(
22
+ (child) => child.type === "comment" || child.type !== "text" || !/^\n+$/.test(child.value)
23
+ );
24
+ if (node.tagName !== "li") return CONTINUE;
25
+ const [firstChild, ...otherChildren] = node.children;
26
+ const comment = [];
27
+ if (firstChild?.type === "text") {
28
+ const [filename, ...fragments] = firstChild.value.split(" ");
29
+ firstChild.value = filename || "";
30
+ const textComment = fragments.join(" ").trim();
31
+ if (textComment.length > 0) {
32
+ comment.push(fragments.join(" "));
33
+ }
34
+ }
35
+ const subTreeIndex = otherChildren.findIndex(
36
+ (child) => child.type === "element" && child.tagName === "ul"
37
+ );
38
+ const commentNodes = subTreeIndex > -1 ? otherChildren.slice(0, subTreeIndex) : [...otherChildren];
39
+ otherChildren.splice(0, subTreeIndex > -1 ? subTreeIndex : otherChildren.length);
40
+ comment.push(...commentNodes);
41
+ const firstChildTextContent = firstChild ? toString(firstChild) : "";
42
+ const isDirectory = /\/\s*$/.test(firstChildTextContent) || otherChildren.some((child) => child.type === "element" && child.tagName === "ul");
43
+ const isPlaceholder = /^\s*(\.{3}|…)\s*$/.test(firstChildTextContent);
44
+ const isHighlighted = firstChild?.type === "element" && firstChild.tagName === "strong";
45
+ const icon = h("span", isDirectory ? folderIcon : getFileIcon(firstChildTextContent));
46
+ if (isDirectory) {
47
+ icon.children.unshift(h("span", { class: "sr-only" }, directoryLabel));
48
+ }
49
+ node.properties.class = isDirectory ? "directory" : "file";
50
+ if (isPlaceholder) node.properties.class += " empty";
51
+ const treeEntryChildren = [
52
+ h("span", { class: isHighlighted ? "highlight" : "" }, [
53
+ isPlaceholder ? null : icon,
54
+ firstChild
55
+ ])
56
+ ];
57
+ if (comment.length > 0) {
58
+ treeEntryChildren.push(makeText(" "), h("span", { class: "comment" }, ...comment));
59
+ }
60
+ const treeEntry = h("span", { class: "tree-entry" }, ...treeEntryChildren);
61
+ if (isDirectory) {
62
+ const hasContents = otherChildren.length > 0;
63
+ node.children = [
64
+ h("details", { open: hasContents }, [
65
+ h("summary", treeEntry),
66
+ ...hasContents ? otherChildren : [h("ul", h("li", "\u2026"))]
67
+ ])
68
+ ];
69
+ return CONTINUE;
70
+ }
71
+ node.children = [treeEntry, ...otherChildren];
72
+ return SKIP;
73
+ });
74
+ };
75
+ });
76
+ function makeText(value = "") {
77
+ return { type: "text", value };
78
+ }
79
+ function makeSVGIcon(svgString) {
80
+ return s(
81
+ "svg",
82
+ {
83
+ width: 16,
84
+ height: 16,
85
+ class: "tree-icon",
86
+ "aria-hidden": "true",
87
+ viewBox: "0 0 24 24"
88
+ },
89
+ fromHtml(svgString, { fragment: true })
90
+ );
91
+ }
92
+ function getFileIcon(fileName) {
93
+ const name = getFileIconName(fileName);
94
+ if (!name) return defaultFileIcon;
95
+ if (name in Icons) {
96
+ const path = Icons[name];
97
+ return makeSVGIcon(path);
98
+ }
99
+ return defaultFileIcon;
100
+ }
101
+ function getFileIconName(fileName) {
102
+ let icon = definitions.files[fileName];
103
+ if (icon) return icon;
104
+ icon = getFileIconTypeFromExtension(fileName);
105
+ if (icon) return icon;
106
+ for (const [partial, partialIcon] of Object.entries(definitions.partials)) {
107
+ if (fileName.includes(partial)) return partialIcon;
108
+ }
109
+ return icon;
110
+ }
111
+ function getFileIconTypeFromExtension(fileName) {
112
+ const firstDotIndex = fileName.indexOf(".");
113
+ if (firstDotIndex === -1) return;
114
+ let extension = fileName.slice(firstDotIndex);
115
+ while (extension !== "") {
116
+ const icon = definitions.extensions[extension];
117
+ if (icon) return icon;
118
+ const nextDotIndex = extension.indexOf(".", 1);
119
+ if (nextDotIndex === -1) return;
120
+ extension = extension.slice(nextDotIndex);
121
+ }
122
+ return;
123
+ }
124
+ function validateFileTree(tree) {
125
+ const rootElements = tree.children.filter(isElementNode);
126
+ const [rootElement] = rootElements;
127
+ if (rootElements.length === 0) {
128
+ throwFileTreeValidationError(
129
+ "The `<FileTree>` component expects its content to be a single unordered list but found no child elements."
130
+ );
131
+ }
132
+ if (rootElements.length !== 1) {
133
+ throwFileTreeValidationError(
134
+ `The \`<FileTree>\` component expects its content to be a single unordered list but found multiple child elements: ${rootElements.map((element) => `\`<${element.tagName}>\``).join(" - ")}.`
135
+ );
136
+ }
137
+ if (!rootElement || rootElement.tagName !== "ul") {
138
+ throwFileTreeValidationError(
139
+ `The \`<FileTree>\` component expects its content to be an unordered list but found the following element: \`<${rootElement?.tagName}>\`.`
140
+ );
141
+ }
142
+ const listItemElement = select("li", rootElement);
143
+ if (!listItemElement) {
144
+ throwFileTreeValidationError(
145
+ "The `<FileTree>` component expects its content to be an unordered list with at least one list item."
146
+ );
147
+ }
148
+ }
149
+ function isElementNode(node) {
150
+ return node.type === "element";
151
+ }
152
+ function throwFileTreeValidationError(message) {
153
+ throw new AstroError(
154
+ message,
155
+ "To learn more about the `<FileTree>` component, see https://starlight.astro.build/components/file-tree/"
156
+ );
157
+ }
158
+ export {
159
+ processFileTree
160
+ };
@@ -0,0 +1,53 @@
1
+ import { AstroError } from "astro/errors";
2
+ import { rehype } from "rehype";
3
+ import rehypeFormat from "rehype-format";
4
+ const prettyPrintProcessor = rehype().data("settings", { fragment: true }).use(rehypeFormat);
5
+ const prettyPrintHtml = (html) => prettyPrintProcessor.processSync({ value: html }).toString();
6
+ const stepsProcessor = rehype().data("settings", { fragment: true }).use(function steps() {
7
+ return (tree, vfile) => {
8
+ const rootElements = tree.children.filter((item) => item.type === "element");
9
+ const [rootElement] = rootElements;
10
+ if (!rootElement) {
11
+ throw new StepsError(
12
+ "The `<Steps>` component expects its content to be a single ordered list (`<ol>`) but found no child elements."
13
+ );
14
+ } else if (rootElements.length > 1) {
15
+ throw new StepsError(
16
+ "The `<Steps>` component expects its content to be a single ordered list (`<ol>`) but found multiple child elements: " + rootElements.map((element) => `\`<${element.tagName}>\``).join(", ") + ".",
17
+ vfile.value.toString()
18
+ );
19
+ } else if (rootElement.tagName !== "ol") {
20
+ throw new StepsError(
21
+ `The \`<Steps>\` component expects its content to be a single ordered list (\`<ol>\`) but found the following element: \`<${rootElement.tagName}>\`.`,
22
+ vfile.value.toString()
23
+ );
24
+ }
25
+ rootElement.properties.role = "list";
26
+ if (!Array.isArray(rootElement.properties.className)) {
27
+ rootElement.properties.className = ["sl-steps"];
28
+ } else {
29
+ rootElement.properties.className.push("sl-steps");
30
+ }
31
+ if (typeof rootElement.properties.start === "number") {
32
+ const styles = [`--sl-steps-start: ${rootElement.properties.start - 1}`];
33
+ if (rootElement.properties.style) styles.push(String(rootElement.properties.style));
34
+ rootElement.properties.style = styles.join(";");
35
+ }
36
+ };
37
+ });
38
+ const processSteps = (html) => {
39
+ const file = stepsProcessor.processSync({ value: html });
40
+ return { html: file.toString() };
41
+ };
42
+ class StepsError extends AstroError {
43
+ constructor(message, html) {
44
+ let hint = "To learn more about the `<Steps>` component, see https://starlight.astro.build/components/steps/";
45
+ if (html) {
46
+ hint += "\n\nFull HTML passed to `<Steps>`:\n" + prettyPrintHtml(html);
47
+ }
48
+ super(message, hint);
49
+ }
50
+ }
51
+ export {
52
+ processSteps
53
+ };
@@ -0,0 +1,73 @@
1
+ import { select } from "hast-util-select";
2
+ import { rehype } from "rehype";
3
+ import { CONTINUE, SKIP, visit } from "unist-util-visit";
4
+ const TabItemTagname = "starlight-tab-item";
5
+ const focusableElementSelectors = [
6
+ "input:not([disabled]):not([type=hidden])",
7
+ "select:not([disabled])",
8
+ "textarea:not([disabled])",
9
+ "button:not([disabled])",
10
+ "a[href]",
11
+ "area[href]",
12
+ "summary",
13
+ "iframe",
14
+ "object",
15
+ "embed",
16
+ "audio[controls]",
17
+ "video[controls]",
18
+ "[contenteditable]",
19
+ "[tabindex]:not([disabled])"
20
+ ].map((selector) => `${selector}:not([hidden]):not([tabindex="-1"])`).join(",");
21
+ let count = 0;
22
+ const getIDs = () => {
23
+ const id = count++;
24
+ return { panelId: "tab-panel-" + id, tabId: "tab-" + id };
25
+ };
26
+ const tabsProcessor = rehype().data("settings", { fragment: true }).use(function tabs() {
27
+ return (tree, file) => {
28
+ file.data.panels = [];
29
+ let isFirst = true;
30
+ visit(tree, "element", (node) => {
31
+ if (node.tagName !== TabItemTagname || !node.properties) {
32
+ return CONTINUE;
33
+ }
34
+ const { dataLabel, dataIcon } = node.properties;
35
+ const ids = getIDs();
36
+ const panel = {
37
+ ...ids,
38
+ label: String(dataLabel)
39
+ };
40
+ if (dataIcon) panel.icon = String(dataIcon);
41
+ file.data.panels?.push(panel);
42
+ delete node.properties.dataLabel;
43
+ delete node.properties.dataIcon;
44
+ node.tagName = "div";
45
+ node.properties.id = ids.panelId;
46
+ node.properties["aria-labelledby"] = ids.tabId;
47
+ node.properties.role = "tabpanel";
48
+ const focusableChild = select(focusableElementSelectors, node);
49
+ if (!focusableChild) {
50
+ node.properties.tabindex = 0;
51
+ }
52
+ if (isFirst) {
53
+ isFirst = false;
54
+ } else {
55
+ node.properties.hidden = true;
56
+ }
57
+ return SKIP;
58
+ });
59
+ };
60
+ });
61
+ const processPanels = (html) => {
62
+ const file = tabsProcessor.processSync({ value: html });
63
+ return {
64
+ /** Data for each tab panel. */
65
+ panels: file.data.panels,
66
+ /** Processed HTML for the tab panels. */
67
+ html: file.toString()
68
+ };
69
+ };
70
+ export {
71
+ TabItemTagname,
72
+ processPanels
73
+ };
@@ -0,0 +1,14 @@
1
+ import { stripLeadingSlash, stripTrailingSlash } from "./path.js";
2
+ const base = stripTrailingSlash(import.meta.env.BASE_URL);
3
+ function pathWithBase(path) {
4
+ path = stripLeadingSlash(path);
5
+ return path ? base + "/" + path : base + "/";
6
+ }
7
+ function fileWithBase(path) {
8
+ path = stripLeadingSlash(path);
9
+ return path ? base + "/" + path : base;
10
+ }
11
+ export {
12
+ fileWithBase,
13
+ pathWithBase
14
+ };
@@ -0,0 +1,13 @@
1
+ import { ensureTrailingSlash, stripTrailingSlash } from "./path.js";
2
+ const canonicalTrailingSlashStrategies = {
3
+ always: ensureTrailingSlash,
4
+ never: stripTrailingSlash,
5
+ ignore: ensureTrailingSlash
6
+ };
7
+ function formatCanonical(href, opts) {
8
+ if (opts.format === "file") return href;
9
+ return canonicalTrailingSlashStrategies[opts.trailingSlash](href);
10
+ }
11
+ export {
12
+ formatCanonical
13
+ };
@@ -0,0 +1,13 @@
1
+ import { resolve } from "node:path";
2
+ import { fileURLToPath } from "node:url";
3
+ import { getCollectionUrl } from "./collection.js";
4
+ function resolveCollectionPath(collection, srcDir) {
5
+ return resolve(fileURLToPath(srcDir), `content/${collection}`);
6
+ }
7
+ function getCollectionPosixPath(collection, srcDir) {
8
+ return fileURLToPath(getCollectionUrl(collection, srcDir)).replace(/\\/g, "/");
9
+ }
10
+ export {
11
+ getCollectionPosixPath,
12
+ resolveCollectionPath
13
+ };
@@ -0,0 +1,16 @@
1
+ function getCollectionUrl(collection, srcDir) {
2
+ return new URL(`content/${getCollectionDir(collection)}/`, srcDir);
3
+ }
4
+ function getCollectionDir(collection) {
5
+ return collection === "docs" ? "knowledge" : collection;
6
+ }
7
+ function getCollectionPathFromRoot(collection, { root, srcDir }) {
8
+ return (typeof srcDir === "string" ? srcDir : srcDir.pathname).replace(
9
+ typeof root === "string" ? root : root.pathname,
10
+ ""
11
+ ) + "content/" + getCollectionDir(collection);
12
+ }
13
+ export {
14
+ getCollectionPathFromRoot,
15
+ getCollectionUrl
16
+ };
@@ -0,0 +1,39 @@
1
+ import { fileWithBase, pathWithBase } from "./base.js";
2
+ import {
3
+ ensureHtmlExtension,
4
+ ensureTrailingSlash,
5
+ stripHtmlExtension,
6
+ stripTrailingSlash
7
+ } from "./path.js";
8
+ const defaultFormatStrategy = {
9
+ addBase: pathWithBase,
10
+ handleExtension: (href) => stripHtmlExtension(href)
11
+ };
12
+ const formatStrategies = {
13
+ file: {
14
+ addBase: fileWithBase,
15
+ handleExtension: (href) => ensureHtmlExtension(href)
16
+ },
17
+ directory: defaultFormatStrategy,
18
+ preserve: defaultFormatStrategy
19
+ };
20
+ const trailingSlashStrategies = {
21
+ always: ensureTrailingSlash,
22
+ never: stripTrailingSlash,
23
+ ignore: (href) => href
24
+ };
25
+ function formatPath(href, { format = "directory", trailingSlash = "ignore" }) {
26
+ const formatStrategy = formatStrategies[format];
27
+ const trailingSlashStrategy = trailingSlashStrategies[trailingSlash];
28
+ href = formatStrategy.handleExtension(href);
29
+ href = formatStrategy.addBase(href);
30
+ if (format === "file") return href;
31
+ href = href === "/" ? href : trailingSlashStrategy(href);
32
+ return href;
33
+ }
34
+ function createPathFormatter(opts) {
35
+ return (href) => formatPath(href, opts);
36
+ }
37
+ export {
38
+ createPathFormatter
39
+ };
@@ -0,0 +1,60 @@
1
+ import i18next from "i18next";
2
+ import builtinTranslations from "../translations/index.js";
3
+ import { BuiltInDefaultLocale } from "./i18n.js";
4
+ const I18nextNamespace = "starlight";
5
+ async function createTranslationSystem(config, userTranslations, pluginTranslations = {}) {
6
+ const defaultLocale = config.defaultLocale.lang || config.defaultLocale?.locale || BuiltInDefaultLocale.lang;
7
+ const translations = {
8
+ [defaultLocale]: buildResources(
9
+ builtinTranslations[defaultLocale],
10
+ builtinTranslations[stripLangRegion(defaultLocale)],
11
+ pluginTranslations[defaultLocale],
12
+ userTranslations[defaultLocale]
13
+ )
14
+ };
15
+ if (config.locales) {
16
+ for (const locale in config.locales) {
17
+ const lang = localeToLang(locale, config.locales, config.defaultLocale);
18
+ translations[lang] = buildResources(
19
+ builtinTranslations[lang] || builtinTranslations[stripLangRegion(lang)],
20
+ pluginTranslations[lang],
21
+ userTranslations[lang]
22
+ );
23
+ }
24
+ }
25
+ const i18n = i18next.createInstance();
26
+ await i18n.init({
27
+ resources: translations,
28
+ fallbackLng: config.defaultLocale.lang || config.defaultLocale?.locale || BuiltInDefaultLocale.lang
29
+ });
30
+ return (lang) => {
31
+ lang ??= config.defaultLocale?.lang || BuiltInDefaultLocale.lang;
32
+ const t = i18n.getFixedT(lang, I18nextNamespace);
33
+ t.all = () => i18n.getResourceBundle(lang, I18nextNamespace);
34
+ t.exists = (key, options) => i18n.exists(key, { lng: lang, ns: I18nextNamespace, ...options });
35
+ t.dir = (dirLang = lang) => i18n.dir(dirLang);
36
+ return t;
37
+ };
38
+ }
39
+ function stripLangRegion(lang) {
40
+ return lang.replace(/-[a-zA-Z]{2}/, "");
41
+ }
42
+ function localeToLang(locale, locales, defaultLocale) {
43
+ const lang = locale ? locales?.[locale]?.lang : locales?.root?.lang;
44
+ const defaultLang = defaultLocale?.lang || defaultLocale?.locale;
45
+ return lang || defaultLang || BuiltInDefaultLocale.lang;
46
+ }
47
+ function buildResources(...dictionaries) {
48
+ const dictionary = {};
49
+ for (const dict of dictionaries) {
50
+ for (const key in dict) {
51
+ const value = dict[key];
52
+ if (value) dictionary[key] = value;
53
+ }
54
+ }
55
+ return { [I18nextNamespace]: dictionary };
56
+ }
57
+ export {
58
+ I18nextNamespace,
59
+ createTranslationSystem
60
+ };
@@ -0,0 +1,110 @@
1
+ import { AstroError } from "astro/errors";
2
+ function parseWithFriendlyErrors(schema, input, message) {
3
+ return processParsedData(schema.safeParse(input, { errorMap }), message);
4
+ }
5
+ async function parseAsyncWithFriendlyErrors(schema, input, message) {
6
+ return processParsedData(await schema.safeParseAsync(input, { errorMap }), message);
7
+ }
8
+ function processParsedData(parsedData, message) {
9
+ if (!parsedData.success) {
10
+ throw new AstroError(message, parsedData.error.issues.map((i) => i.message).join("\n"));
11
+ }
12
+ return parsedData.data;
13
+ }
14
+ const errorMap = (baseError, ctx) => {
15
+ const baseErrorPath = flattenErrorPath(baseError.path);
16
+ if (baseError.code === "invalid_union") {
17
+ const typeOrLiteralErrByPath = /* @__PURE__ */ new Map();
18
+ for (const unionError of baseError.unionErrors.map((e) => e.errors).flat()) {
19
+ if (unionError.code === "invalid_type" || unionError.code === "invalid_literal") {
20
+ const flattenedErrorPath = flattenErrorPath(unionError.path);
21
+ if (typeOrLiteralErrByPath.has(flattenedErrorPath)) {
22
+ typeOrLiteralErrByPath.get(flattenedErrorPath).expected.push(unionError.expected);
23
+ } else {
24
+ typeOrLiteralErrByPath.set(flattenedErrorPath, {
25
+ code: unionError.code,
26
+ received: unionError.received,
27
+ expected: [unionError.expected]
28
+ });
29
+ }
30
+ }
31
+ }
32
+ const messages = [prefix(baseErrorPath, "Did not match union.")];
33
+ const details = [...typeOrLiteralErrByPath.entries()].filter(([, error]) => error.expected.length === baseError.unionErrors.length).map(
34
+ ([key, error]) => key === baseErrorPath ? (
35
+ // Avoid printing the key again if it's a base error
36
+ `> ${getTypeOrLiteralMsg(error)}`
37
+ ) : `> ${prefix(key, getTypeOrLiteralMsg(error))}`
38
+ );
39
+ if (details.length === 0) {
40
+ const expectedShapes = [];
41
+ for (const unionError of baseError.unionErrors) {
42
+ const expectedShape = [];
43
+ for (const issue of unionError.issues) {
44
+ if (issue.code === "invalid_union") {
45
+ return errorMap(issue, ctx);
46
+ }
47
+ const relativePath = flattenErrorPath(issue.path).replace(baseErrorPath, "").replace(leadingPeriod, "");
48
+ if ("expected" in issue && typeof issue.expected === "string") {
49
+ expectedShape.push(
50
+ relativePath ? `${relativePath}: ${issue.expected}` : issue.expected
51
+ );
52
+ } else {
53
+ expectedShape.push(relativePath);
54
+ }
55
+ }
56
+ if (expectedShape.length === 1 && !expectedShape[0]?.includes(":")) {
57
+ expectedShapes.push(expectedShape.join(""));
58
+ } else {
59
+ expectedShapes.push(`{ ${expectedShape.join("; ")} }`);
60
+ }
61
+ }
62
+ if (expectedShapes.length) {
63
+ details.push("> Expected type `" + expectedShapes.join(" | ") + "`");
64
+ details.push("> Received `" + stringify(ctx.data) + "`");
65
+ }
66
+ }
67
+ return {
68
+ message: messages.concat(details).join("\n")
69
+ };
70
+ } else if (baseError.code === "invalid_literal" || baseError.code === "invalid_type") {
71
+ return {
72
+ message: prefix(
73
+ baseErrorPath,
74
+ getTypeOrLiteralMsg({
75
+ code: baseError.code,
76
+ received: baseError.received,
77
+ expected: [baseError.expected]
78
+ })
79
+ )
80
+ };
81
+ } else if (baseError.message) {
82
+ return { message: prefix(baseErrorPath, baseError.message) };
83
+ } else {
84
+ return { message: prefix(baseErrorPath, ctx.defaultError) };
85
+ }
86
+ };
87
+ const getTypeOrLiteralMsg = (error) => {
88
+ if (typeof error.received === "undefined" || error.received === "undefined") return "Required";
89
+ const expectedDeduped = new Set(error.expected);
90
+ switch (error.code) {
91
+ case "invalid_type":
92
+ return `Expected type \`${unionExpectedVals(expectedDeduped)}\`, received \`${stringify(
93
+ error.received
94
+ )}\``;
95
+ case "invalid_literal":
96
+ return `Expected \`${unionExpectedVals(expectedDeduped)}\`, received \`${stringify(
97
+ error.received
98
+ )}\``;
99
+ }
100
+ };
101
+ const prefix = (key, msg) => key.length ? `**${key}**: ${msg}` : msg;
102
+ const unionExpectedVals = (expectedVals) => [...expectedVals].map((expectedVal) => stringify(expectedVal)).join(" | ");
103
+ const flattenErrorPath = (errorPath) => errorPath.join(".");
104
+ const stringify = (val) => JSON.stringify(val, null, 1).split(newlinePlusWhitespace).join(" ");
105
+ const newlinePlusWhitespace = /\n\s*/;
106
+ const leadingPeriod = /^\./;
107
+ export {
108
+ parseAsyncWithFriendlyErrors,
109
+ parseWithFriendlyErrors
110
+ };
@@ -0,0 +1,9 @@
1
+ import project from "virtual:starlight/project-context";
2
+ import { createPathFormatter } from "./createPathFormatter.js";
3
+ const formatPath = createPathFormatter({
4
+ format: project.build.format,
5
+ trailingSlash: project.trailingSlash
6
+ });
7
+ export {
8
+ formatPath
9
+ };
@@ -0,0 +1,18 @@
1
+ import { PAGE_TITLE_ID } from "../constants.js";
2
+ function generateToC(headings, { minHeadingLevel, maxHeadingLevel, title }) {
3
+ headings = headings.filter(({ depth }) => depth >= minHeadingLevel && depth <= maxHeadingLevel);
4
+ const toc = [{ depth: 2, slug: PAGE_TITLE_ID, text: title, children: [] }];
5
+ for (const heading of headings) injectChild(toc, { ...heading, children: [] });
6
+ return toc;
7
+ }
8
+ function injectChild(items, item) {
9
+ const lastItem = items.at(-1);
10
+ if (!lastItem || lastItem.depth >= item.depth) {
11
+ items.push(item);
12
+ } else {
13
+ return injectChild(lastItem.children, item);
14
+ }
15
+ }
16
+ export {
17
+ generateToC
18
+ };
@@ -0,0 +1,92 @@
1
+ import { basename, dirname, relative, resolve } from "node:path";
2
+ import { realpathSync } from "node:fs";
3
+ import { spawnSync } from "node:child_process";
4
+ const makeAPI = (directory) => {
5
+ return {
6
+ getNewestCommitDate: (file) => getNewestCommitDate(resolve(directory, file))
7
+ };
8
+ };
9
+ function getNewestCommitDate(file) {
10
+ const result = spawnSync("git", ["log", "--format=%ct", "--max-count=1", basename(file)], {
11
+ cwd: dirname(file),
12
+ encoding: "utf-8"
13
+ });
14
+ if (result.error) {
15
+ throw new Error(`Failed to retrieve the git history for file "${file}"`);
16
+ }
17
+ const output = result.stdout.trim();
18
+ const regex = /^(?<timestamp>\d+)$/;
19
+ const match = output.match(regex);
20
+ if (!match?.groups?.timestamp) {
21
+ throw new Error(`Failed to validate the timestamp for file "${file}"`);
22
+ }
23
+ const timestamp = Number(match.groups.timestamp);
24
+ const date = new Date(timestamp * 1e3);
25
+ return date;
26
+ }
27
+ function getRepoRoot(directory) {
28
+ const result = spawnSync("git", ["rev-parse", "--show-toplevel"], {
29
+ cwd: directory,
30
+ encoding: "utf-8"
31
+ });
32
+ if (result.error) {
33
+ return directory;
34
+ }
35
+ try {
36
+ return realpathSync(result.stdout.trim());
37
+ } catch {
38
+ return directory;
39
+ }
40
+ }
41
+ function getAllNewestCommitDate(rootPath, docsPath) {
42
+ const repoRoot = getRepoRoot(docsPath);
43
+ const gitLog = spawnSync(
44
+ "git",
45
+ [
46
+ "log",
47
+ // Format each history entry as t:<seconds since epoch>
48
+ "--format=t:%ct",
49
+ // In each entry include the name and status for each modified file
50
+ "--name-status",
51
+ "--",
52
+ docsPath
53
+ ],
54
+ {
55
+ cwd: repoRoot,
56
+ encoding: "utf-8",
57
+ // The default `maxBuffer` for `spawnSync` is 1024 * 1024 bytes, a.k.a 1 MB. In big projects,
58
+ // the full git history can be larger than this, so we increase this to ~10 MB. For example,
59
+ // Cloudflare passed 1 MB with ~4,800 pages and ~17,000 commits. If we get reports of others
60
+ // hitting ENOBUFS errors here in the future, we may want to switch to streaming the git log
61
+ // with `spawn` instead.
62
+ // See https://github.com/withastro/starlight/issues/3154
63
+ maxBuffer: 10 * 1024 * 1024
64
+ }
65
+ );
66
+ if (gitLog.error) {
67
+ return [];
68
+ }
69
+ let runningDate = Date.now();
70
+ const latestDates = /* @__PURE__ */ new Map();
71
+ for (const logLine of gitLog.stdout.split("\n")) {
72
+ if (logLine.startsWith("t:")) {
73
+ runningDate = Number.parseInt(logLine.slice(2)) * 1e3;
74
+ }
75
+ const tabSplit = logLine.lastIndexOf(" ");
76
+ if (tabSplit === -1) continue;
77
+ const fileName = logLine.slice(tabSplit + 1);
78
+ const currentLatest = latestDates.get(fileName) || 0;
79
+ latestDates.set(fileName, Math.max(currentLatest, runningDate));
80
+ }
81
+ return Array.from(latestDates.entries()).map(([file, date]) => {
82
+ const fileFullPath = resolve(repoRoot, file);
83
+ let fileInDirectory = relative(rootPath, fileFullPath);
84
+ fileInDirectory = fileInDirectory?.replace(/\\/g, "/");
85
+ return [fileInDirectory, date];
86
+ });
87
+ }
88
+ export {
89
+ getAllNewestCommitDate,
90
+ getNewestCommitDate,
91
+ makeAPI
92
+ };