@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,172 @@
1
+ import fs from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ import process from 'node:process';
4
+ import { packageRoot } from './paths.js';
5
+ const legacyDocsRoot = path.resolve(packageRoot, '../..');
6
+ const candidateStarlightRoots = [
7
+ path.join(process.cwd(), 'node_modules/@astrojs/starlight'),
8
+ path.join(packageRoot, 'node_modules/@astrojs/starlight'),
9
+ path.join(legacyDocsRoot, 'node_modules/@astrojs/starlight'),
10
+ ];
11
+ const candidateCollectionFiles = [
12
+ path.join(process.cwd(), 'node_modules/@astrojs/starlight/utils/collection.ts'),
13
+ path.join(packageRoot, 'node_modules/@astrojs/starlight/utils/collection.ts'),
14
+ path.join(legacyDocsRoot, 'node_modules/@astrojs/starlight/utils/collection.ts'),
15
+ ];
16
+ const originalSource = `export type StarlightCollection = 'docs' | 'i18n';
17
+
18
+ /**
19
+ * We still rely on the content collection folder structure to be fixed for now:
20
+ *
21
+ * - At build time, if the feature is enabled, we get all the last commit dates for each file in
22
+ * the docs folder ahead of time. In the current approach, we cannot know at this time the
23
+ * user-defined content folder path in the integration context as this would only be available
24
+ * from the loader. A potential solution could be to do that from a custom loader re-implementing
25
+ * the glob loader or built on top of it. Although, we don't have access to the Starlight
26
+ * configuration from the loader to even know we should do that.
27
+ * - Remark plugins get passed down an absolute path to a content file and we need to figure out
28
+ * the language from that path. Without knowing the content folder path, we cannot reliably do
29
+ * so.
30
+ *
31
+ * Below are various functions to easily get paths to these collections and avoid having to
32
+ * hardcode them throughout the codebase. When user-defined content folder locations are supported,
33
+ * these helper functions should be updated to reflect that in one place.
34
+ */
35
+
36
+ export function getCollectionUrl(collection: StarlightCollection, srcDir: URL) {
37
+ \treturn new URL(\`content/\${collection}/\`, srcDir);
38
+ }
39
+
40
+ export function getCollectionPathFromRoot(
41
+ \tcollection: StarlightCollection,
42
+ \t{ root, srcDir }: { root: URL | string; srcDir: URL | string }
43
+ ) {
44
+ \treturn (
45
+ \t\t(typeof srcDir === 'string' ? srcDir : srcDir.pathname).replace(
46
+ \t\t\ttypeof root === 'string' ? root : root.pathname,
47
+ \t\t\t''
48
+ \t\t) +
49
+ \t\t'content/' +
50
+ \t\tcollection
51
+ \t);
52
+ }
53
+ `;
54
+ const patchedSource = `export type StarlightCollection = 'docs' | 'i18n';
55
+
56
+ /**
57
+ * We still rely on the content collection folder structure to be fixed for now:
58
+ *
59
+ * - At build time, if the feature is enabled, we get all the last commit dates for each file in
60
+ * the docs folder ahead of time. In the current approach, we cannot know at this time the
61
+ * user-defined content folder path in the integration context as this would only be available
62
+ * from the loader. A potential solution could be to do that from a custom loader re-implementing
63
+ * the glob loader or built on top of it. Although, we don't have access to the Starlight
64
+ * configuration from the loader to even know we should do that.
65
+ * - Remark plugins get passed down an absolute path to a content file and we need to figure out
66
+ * the language from that path. Without knowing the content folder path, we cannot reliably do
67
+ * so.
68
+ *
69
+ * Below are various functions to easily get paths to these collections and avoid having to
70
+ * hardcode them throughout the codebase. When user-defined content folder locations are supported,
71
+ * these helper functions should be updated to reflect that in one place.
72
+ */
73
+
74
+ export function getCollectionUrl(collection: StarlightCollection, srcDir: URL) {
75
+ \treturn new URL(\`content/\${getCollectionDir(collection)}/\`, srcDir);
76
+ }
77
+
78
+ function getCollectionDir(collection: StarlightCollection) {
79
+ \treturn collection === 'docs' ? 'knowledge' : collection;
80
+ }
81
+
82
+ export function getCollectionPathFromRoot(
83
+ \tcollection: StarlightCollection,
84
+ \t{ root, srcDir }: { root: URL | string; srcDir: URL | string }
85
+ ) {
86
+ \treturn (
87
+ \t\t(typeof srcDir === 'string' ? srcDir : srcDir.pathname).replace(
88
+ \t\t\ttypeof root === 'string' ? root : root.pathname,
89
+ \t\t\t''
90
+ \t\t) +
91
+ \t\t'content/' +
92
+ \t\tgetCollectionDir(collection)
93
+ \t);
94
+ }
95
+ `;
96
+ async function patchCollectionFile(collectionFile) {
97
+ const source = await fs.readFile(collectionFile, 'utf8');
98
+ if (source === patchedSource) {
99
+ return 'already';
100
+ }
101
+ if (source !== originalSource) {
102
+ throw new Error(`Unexpected Starlight collection helper format in ${collectionFile}`);
103
+ }
104
+ await fs.writeFile(collectionFile, patchedSource);
105
+ return 'patched';
106
+ }
107
+ async function copyVendoredTree(sourceRoot, targetRoot) {
108
+ const entries = await fs.readdir(sourceRoot, { withFileTypes: true });
109
+ for (const entry of entries) {
110
+ const sourcePath = path.join(sourceRoot, entry.name);
111
+ const targetPath = path.join(targetRoot, entry.name);
112
+ if (entry.isDirectory()) {
113
+ await fs.mkdir(targetPath, { recursive: true });
114
+ await copyVendoredTree(sourcePath, targetPath);
115
+ continue;
116
+ }
117
+ await fs.copyFile(sourcePath, targetPath);
118
+ }
119
+ }
120
+ async function patchStarlightPackageRoot(starlightRoot) {
121
+ const packageJsonPath = path.join(starlightRoot, 'package.json');
122
+ const packageJson = JSON.parse(await fs.readFile(packageJsonPath, 'utf8'));
123
+ const coreVendorRoot = path.join(path.dirname(path.dirname(starlightRoot)), '@treeseed/core/dist/vendor/starlight');
124
+ await copyVendoredTree(coreVendorRoot, starlightRoot);
125
+ packageJson.exports = {
126
+ ...packageJson.exports,
127
+ '.': './index.js',
128
+ './schema': './schema.js',
129
+ './loaders': './loaders.js',
130
+ './route-data': './route-data.js',
131
+ './internal': './internal.js',
132
+ './components': './components.js',
133
+ };
134
+ await fs.writeFile(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}\n`, 'utf8');
135
+ }
136
+ async function run() {
137
+ const existingFiles = [];
138
+ for (const collectionFile of candidateCollectionFiles) {
139
+ try {
140
+ await fs.access(collectionFile);
141
+ existingFiles.push(collectionFile);
142
+ }
143
+ catch {
144
+ // Ignore missing dependency trees.
145
+ }
146
+ }
147
+ if (existingFiles.length === 0) {
148
+ throw new Error('Unable to find any Starlight collection helper files to patch.');
149
+ }
150
+ let patchedAny = false;
151
+ for (const collectionFile of existingFiles) {
152
+ const result = await patchCollectionFile(collectionFile);
153
+ patchedAny = patchedAny || result === 'patched';
154
+ }
155
+ for (const starlightRoot of candidateStarlightRoots) {
156
+ try {
157
+ await fs.access(path.join(starlightRoot, 'package.json'));
158
+ await patchStarlightPackageRoot(starlightRoot);
159
+ patchedAny = true;
160
+ }
161
+ catch {
162
+ // Ignore missing dependency trees.
163
+ }
164
+ }
165
+ console.log(patchedAny
166
+ ? 'Applied Starlight knowledge-path patch.'
167
+ : 'Starlight knowledge-path patch already applied.');
168
+ }
169
+ run().catch((error) => {
170
+ console.error(error instanceof Error ? error.message : String(error));
171
+ process.exitCode = 1;
172
+ });
@@ -0,0 +1,11 @@
1
+ import { resolve } from 'node:path';
2
+ import { fileURLToPath } from 'node:url';
3
+ import { requireSharedFixtureRoot } from './fixture-tools.js';
4
+ const packageCandidate = resolve(fileURLToPath(new URL('..', import.meta.url)));
5
+ export const packageRoot = packageCandidate.endsWith('/dist')
6
+ ? resolve(packageCandidate, '..')
7
+ : packageCandidate;
8
+ export const fixtureRoot = requireSharedFixtureRoot();
9
+ export const fixtureWranglerConfig = resolve(fixtureRoot, 'wrangler.toml');
10
+ export const fixtureMigrationsRoot = resolve(fixtureRoot, 'migrations');
11
+ export const fixtureSrcRoot = resolve(fixtureRoot, 'src');
@@ -0,0 +1,20 @@
1
+ import { spawnSync } from 'node:child_process';
2
+ import { resolve } from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ const packageRoot = resolve(fileURLToPath(new URL('..', import.meta.url)));
5
+ const extraArgs = process.argv.slice(2);
6
+ const npmArgs = ['publish', '.', '--access', 'public'];
7
+ if (process.env.GITHUB_ACTIONS === 'true') {
8
+ npmArgs.push('--provenance');
9
+ }
10
+ npmArgs.push(...extraArgs);
11
+ const result = spawnSync('npm', npmArgs, {
12
+ cwd: packageRoot,
13
+ stdio: 'inherit',
14
+ env: process.env,
15
+ });
16
+ if (result.error) {
17
+ console.error(result.error.message);
18
+ process.exit(1);
19
+ }
20
+ process.exit(result.status ?? 1);
@@ -0,0 +1,52 @@
1
+ import { readFileSync, readdirSync } from 'node:fs';
2
+ import { extname, join, resolve } from 'node:path';
3
+ import { spawnSync } from 'node:child_process';
4
+ import { packageRoot } from './package-tools.js';
5
+ const textExtensions = new Set(['.js', '.ts', '.mjs', '.cjs', '.d.js', '.json', '.astro', '.css']);
6
+ const forbiddenPatterns = [
7
+ /['"`]file:[^'"`\n]+['"`]/,
8
+ /['"`]workspace:[^'"`\n]+['"`]/,
9
+ /['"`](?:\.\.\/|\.\/)[^'"`\n]*src\/[^'"`\n]*\.(?:[cm]?js|ts|tsx|json|astro|css)['"`]/,
10
+ /['"`][^'"`\n]*\/packages\/[^'"`\n]*\/src\/[^'"`\n]*['"`]/,
11
+ ];
12
+ function run(command, args) {
13
+ const result = spawnSync(command, args, {
14
+ cwd: packageRoot,
15
+ stdio: 'inherit',
16
+ env: process.env,
17
+ });
18
+ if (result.status !== 0) {
19
+ process.exit(result.status ?? 1);
20
+ }
21
+ }
22
+ function walkFiles(root) {
23
+ const files = [];
24
+ for (const entry of readdirSync(root, { withFileTypes: true })) {
25
+ const fullPath = join(root, entry.name);
26
+ if (entry.isDirectory()) {
27
+ files.push(...walkFiles(fullPath));
28
+ continue;
29
+ }
30
+ files.push(fullPath);
31
+ }
32
+ return files;
33
+ }
34
+ function scanDirectory(root) {
35
+ for (const filePath of walkFiles(root)) {
36
+ if (!textExtensions.has(extname(filePath)))
37
+ continue;
38
+ const source = readFileSync(filePath, 'utf8');
39
+ for (const pattern of forbiddenPatterns) {
40
+ if (pattern.test(source)) {
41
+ throw new Error(`${filePath} contains forbidden publish reference matching ${pattern}.`);
42
+ }
43
+ }
44
+ }
45
+ }
46
+ run('npm', ['run', 'fixtures:check']);
47
+ run('npm', ['run', 'build:dist']);
48
+ scanDirectory(resolve(packageRoot, 'dist'));
49
+ run('npm', ['run', 'test:unit']);
50
+ run('npm', ['run', 'check']);
51
+ run('npm', ['run', 'build']);
52
+ run('npm', ['run', 'test:smoke']);
@@ -0,0 +1,21 @@
1
+ import { spawnSync } from 'node:child_process';
2
+ import { fixtureRoot, packageRoot } from './paths.js';
3
+ const [command, ...rest] = process.argv.slice(2);
4
+ if (!command) {
5
+ console.error('Usage: node ./scripts/run-fixture-astro-command.mjs <check|build|preview|dev> [...args]');
6
+ process.exit(1);
7
+ }
8
+ const result = spawnSync('npx', ['astro', command, '--root', fixtureRoot, ...rest], {
9
+ cwd: packageRoot,
10
+ stdio: 'inherit',
11
+ env: {
12
+ ...process.env,
13
+ TREESEED_TENANT_ROOT: fixtureRoot,
14
+ },
15
+ shell: process.platform === 'win32',
16
+ });
17
+ if (result.error) {
18
+ console.error(result.error.message);
19
+ process.exit(1);
20
+ }
21
+ process.exit(result.status ?? 1);
@@ -0,0 +1,3 @@
1
+ import { astroBin, runNodeBinary } from './package-tools.js';
2
+ const args = process.argv.slice(2);
3
+ runNodeBinary(astroBin, args, { cwd: process.cwd() });
@@ -0,0 +1,16 @@
1
+ import { astroBin, createProductionBuildEnv, packageScriptPath, runNodeBinary, runNodeScript } from './package-tools.js';
2
+ process.env.TREESEED_LOCAL_DEV_MODE = process.env.TREESEED_LOCAL_DEV_MODE ?? 'cloudflare';
3
+ runNodeScript(packageScriptPath('patch-starlight-content-path'), [], { cwd: process.cwd() });
4
+ runNodeScript(packageScriptPath('aggregate-book'), [], { cwd: process.cwd() });
5
+ runNodeBinary(astroBin, ['build'], {
6
+ cwd: process.cwd(),
7
+ env: createProductionBuildEnv({
8
+ TREESEED_LOCAL_DEV_MODE: process.env.TREESEED_LOCAL_DEV_MODE,
9
+ }),
10
+ });
11
+ runNodeScript(packageScriptPath('build-tenant-worker'), [], {
12
+ cwd: process.cwd(),
13
+ env: createProductionBuildEnv({
14
+ TREESEED_LOCAL_DEV_MODE: process.env.TREESEED_LOCAL_DEV_MODE,
15
+ }),
16
+ });
@@ -0,0 +1,7 @@
1
+ import { createProductionBuildEnv, packageScriptPath, runNodeScript } from './package-tools.js';
2
+ runNodeScript(packageScriptPath('patch-starlight-content-path'), [], { cwd: process.cwd() });
3
+ runNodeScript(packageScriptPath('aggregate-book'), [], { cwd: process.cwd() });
4
+ runNodeScript(packageScriptPath('tenant-build'), [], {
5
+ cwd: process.cwd(),
6
+ env: createProductionBuildEnv(),
7
+ });
@@ -0,0 +1,105 @@
1
+ import { existsSync, mkdirSync, readdirSync, rmSync, symlinkSync, writeFileSync } from 'node:fs';
2
+ import { mkdtempSync } from 'node:fs';
3
+ import { tmpdir } from 'node:os';
4
+ import { dirname, join, resolve } from 'node:path';
5
+ import { spawnSync } from 'node:child_process';
6
+ import { createRequire } from 'node:module';
7
+ import { packageRoot } from './package-tools.js';
8
+ const require = createRequire(import.meta.url);
9
+ const sdkPackageRoot = resolve(dirname(require.resolve('@treeseed/sdk')), '..');
10
+ function run(command, args, cwd = packageRoot, capture = false) {
11
+ const result = spawnSync(command, args, {
12
+ cwd,
13
+ stdio: capture ? 'pipe' : 'inherit',
14
+ encoding: 'utf8',
15
+ env: process.env,
16
+ });
17
+ if (result.status !== 0) {
18
+ throw new Error(result.stderr?.trim() || result.stdout?.trim() || `${command} ${args.join(' ')} failed`);
19
+ }
20
+ return (result.stdout ?? '').trim();
21
+ }
22
+ function resolveNodeModulesRoot() {
23
+ let lastCandidate = null;
24
+ let current = packageRoot;
25
+ while (true) {
26
+ const candidate = resolve(current, 'node_modules');
27
+ try {
28
+ readdirSync(candidate);
29
+ lastCandidate = candidate;
30
+ }
31
+ catch {
32
+ }
33
+ const parent = resolve(current, '..');
34
+ if (parent === current)
35
+ break;
36
+ current = parent;
37
+ }
38
+ if (lastCandidate) {
39
+ return lastCandidate;
40
+ }
41
+ throw new Error(`Unable to locate node_modules for ${packageRoot}.`);
42
+ }
43
+ function mirrorDependencies(tempRoot) {
44
+ const sharedNodeModules = resolveNodeModulesRoot();
45
+ for (const entry of readdirSync(sharedNodeModules, { withFileTypes: true })) {
46
+ if (entry.name === '.bin' || entry.name === '@treeseed') {
47
+ continue;
48
+ }
49
+ const targetPath = resolve(tempRoot, 'node_modules', entry.name);
50
+ mkdirSync(dirname(targetPath), { recursive: true });
51
+ symlinkSync(resolve(sharedNodeModules, entry.name), targetPath, 'dir');
52
+ }
53
+ }
54
+ function pack(root, outputRoot, fallbackName) {
55
+ const bundledTarball = readdirSync(root, { withFileTypes: true })
56
+ .filter((entry) => entry.isFile() && entry.name.endsWith('.tgz'))
57
+ .map((entry) => resolve(root, entry.name))
58
+ .sort((left, right) => left.localeCompare(right, undefined, { numeric: true, sensitivity: 'base' }))
59
+ .at(-1);
60
+ if (bundledTarball && !existsSync(resolve(root, 'scripts', 'run-ts.mjs'))) {
61
+ return bundledTarball;
62
+ }
63
+ mkdirSync(outputRoot, { recursive: true });
64
+ const output = run('npm', ['pack', '--silent', '--ignore-scripts', '--pack-destination', outputRoot], root, true);
65
+ const filename = output
66
+ .split('\n')
67
+ .map((line) => line.trim())
68
+ .filter(Boolean)
69
+ .at(-1) ?? fallbackName;
70
+ return resolve(outputRoot, filename);
71
+ }
72
+ function installPackageDirectory(tempRoot, packageRoot, folderName) {
73
+ mkdirSync(resolve(tempRoot, 'node_modules', '@treeseed'), { recursive: true });
74
+ run('cp', ['-R', packageRoot, resolve(tempRoot, 'node_modules', '@treeseed', folderName)]);
75
+ }
76
+ function installPackagedPackage(extractRoot, tempRoot, packageName, folderName) {
77
+ mkdirSync(resolve(tempRoot, 'node_modules', '@treeseed'), { recursive: true });
78
+ run('tar', ['-xzf', packageName, '-C', extractRoot]);
79
+ run('cp', ['-R', resolve(extractRoot, 'package'), resolve(tempRoot, 'node_modules', '@treeseed', folderName)]);
80
+ rmSync(resolve(extractRoot, 'package'), { recursive: true, force: true });
81
+ }
82
+ const stageRoot = mkdtempSync(join(tmpdir(), 'treeseed-core-smoke-'));
83
+ const packRoot = resolve(stageRoot, 'pack');
84
+ const extractRoot = resolve(stageRoot, 'extract');
85
+ const installRoot = resolve(stageRoot, 'install');
86
+ try {
87
+ mkdirSync(packRoot, { recursive: true });
88
+ mkdirSync(extractRoot, { recursive: true });
89
+ const coreTarball = pack(packageRoot, packRoot, 'treeseed-core.tgz');
90
+ if (existsSync(resolve(sdkPackageRoot, 'scripts', 'run-ts.mjs'))) {
91
+ const sdkTarball = pack(sdkPackageRoot, packRoot, 'treeseed-sdk.tgz');
92
+ installPackagedPackage(extractRoot, installRoot, sdkTarball, 'sdk');
93
+ }
94
+ else {
95
+ installPackageDirectory(installRoot, sdkPackageRoot, 'sdk');
96
+ }
97
+ installPackagedPackage(extractRoot, installRoot, coreTarball, 'core');
98
+ mirrorDependencies(installRoot);
99
+ writeFileSync(resolve(installRoot, 'package.json'), `${JSON.stringify({ name: 'treeseed-core-smoke', private: true, type: 'module' }, null, 2)}\n`, 'utf8');
100
+ run(process.execPath, ['--input-type=module', '-e', 'await import("@treeseed/core");'], installRoot);
101
+ console.log('Core packed-install smoke passed.');
102
+ }
103
+ finally {
104
+ rmSync(stageRoot, { recursive: true, force: true });
105
+ }
package/dist/server.js ADDED
@@ -0,0 +1,53 @@
1
+ import { AstroError } from "astro/errors";
2
+ import { AstroJSX, jsx } from "astro/jsx-runtime";
3
+ import { renderJSX } from "astro/runtime/server/index.js";
4
+ const slotName = (str) => str.trim().replace(/[-_]([a-z])/g, (_, w) => w.toUpperCase());
5
+ async function check(Component, props, { default: children = null, ...slotted } = {}) {
6
+ if (typeof Component !== "function") return false;
7
+ const slots = {};
8
+ for (const [key, value] of Object.entries(slotted)) {
9
+ const name = slotName(key);
10
+ slots[name] = value;
11
+ }
12
+ try {
13
+ const result = await Component({ ...props, ...slots, children });
14
+ return result[AstroJSX];
15
+ } catch (e) {
16
+ throwEnhancedErrorIfMdxComponent(e, Component);
17
+ }
18
+ return false;
19
+ }
20
+ async function renderToStaticMarkup(Component, props = {}, { default: children = null, ...slotted } = {}) {
21
+ const slots = {};
22
+ for (const [key, value] of Object.entries(slotted)) {
23
+ const name = slotName(key);
24
+ slots[name] = value;
25
+ }
26
+ const { result } = this;
27
+ try {
28
+ const html = await renderJSX(result, jsx(Component, { ...props, ...slots, children }));
29
+ return { html };
30
+ } catch (e) {
31
+ throwEnhancedErrorIfMdxComponent(e, Component);
32
+ throw e;
33
+ }
34
+ }
35
+ function throwEnhancedErrorIfMdxComponent(error, Component) {
36
+ if (Component[Symbol.for("mdx-component")]) {
37
+ if (AstroError.is(error)) return;
38
+ error.title = error.name;
39
+ error.hint = `This issue often occurs when your MDX component encounters runtime errors.`;
40
+ throw error;
41
+ }
42
+ }
43
+ const renderer = {
44
+ name: "astro:jsx",
45
+ check,
46
+ renderToStaticMarkup
47
+ };
48
+ var server_default = renderer;
49
+ export {
50
+ check,
51
+ server_default as default,
52
+ renderToStaticMarkup
53
+ };
@@ -0,0 +1,29 @@
1
+ import type { TreeseedDeployConfig, TreeseedTenantConfig } from './contracts';
2
+ import type { LoadedTreeseedPluginEntry } from './plugins/runtime';
3
+ export declare const TREESEED_SITE_RESOURCE_KINDS: readonly ["pages", "styles", "components"];
4
+ export type TreeseedSiteResourceKind = (typeof TREESEED_SITE_RESOURCE_KINDS)[number];
5
+ export type TreeseedSiteLayerDefinition = {
6
+ root: string;
7
+ kinds?: TreeseedSiteResourceKind[];
8
+ };
9
+ export type TreeseedSiteLayer = {
10
+ owner: string;
11
+ root: string;
12
+ kinds: TreeseedSiteResourceKind[];
13
+ };
14
+ type SiteLayerBuildContext = {
15
+ projectRoot: string;
16
+ tenantConfig: TreeseedTenantConfig;
17
+ siteConfig?: unknown;
18
+ deployConfig?: TreeseedDeployConfig;
19
+ };
20
+ type SiteLayerRuntime = {
21
+ plugins: LoadedTreeseedPluginEntry[];
22
+ };
23
+ export declare function buildTreeseedSiteLayers(pluginRuntime: SiteLayerRuntime, context: SiteLayerBuildContext & {
24
+ coreRoot: string;
25
+ }): TreeseedSiteLayer[];
26
+ export declare function resolveTreeseedSiteResource(layers: TreeseedSiteLayer[], kind: TreeseedSiteResourceKind, resourcePath: string): string;
27
+ export declare function resolveTreeseedPageEntrypoint(layers: TreeseedSiteLayer[], resourcePath: string): string;
28
+ export declare function resolveTreeseedStyleEntrypoint(layers: TreeseedSiteLayer[], resourcePath: string): string;
29
+ export {};
@@ -0,0 +1,127 @@
1
+ import { existsSync } from "node:fs";
2
+ import { resolve } from "node:path";
3
+ const TREESEED_SITE_RESOURCE_KINDS = ["pages", "styles", "components"];
4
+ const SITE_RESOURCE_KIND_SET = new Set(TREESEED_SITE_RESOURCE_KINDS);
5
+ function normalizeKinds(kinds) {
6
+ if (!kinds || kinds.length === 0) {
7
+ return [...TREESEED_SITE_RESOURCE_KINDS];
8
+ }
9
+ const normalized = [...new Set(kinds)];
10
+ for (const kind of normalized) {
11
+ if (!SITE_RESOURCE_KIND_SET.has(kind)) {
12
+ throw new Error(`Unknown Treeseed site resource kind "${kind}".`);
13
+ }
14
+ }
15
+ return normalized;
16
+ }
17
+ function normalizeResourcePath(kind, resourcePath) {
18
+ const normalized = resourcePath.replace(/\\/g, "/").replace(/^\/+/, "");
19
+ return normalized.startsWith(`${kind}/`) ? normalized : `${kind}/${normalized}`;
20
+ }
21
+ function isKindSupported(layer, kind) {
22
+ return layer.kinds.includes(kind);
23
+ }
24
+ function getTenantRoot(tenantConfig, projectRoot) {
25
+ return tenantConfig.__tenantRoot ?? projectRoot;
26
+ }
27
+ function normalizeLayerDefinition(owner, baseRoot, layer) {
28
+ const kinds = normalizeKinds(layer.kinds);
29
+ const root = resolve(baseRoot, layer.root);
30
+ return {
31
+ owner,
32
+ root,
33
+ kinds
34
+ };
35
+ }
36
+ function getPluginLayers(entry, context) {
37
+ const plugin = entry.plugin;
38
+ const rawLayers = typeof plugin.siteLayers === "function" ? plugin.siteLayers({ ...context, pluginConfig: entry.config ?? {} }) : plugin.siteLayers;
39
+ if (!rawLayers?.length) {
40
+ return [];
41
+ }
42
+ return rawLayers.map((layer) => normalizeLayerDefinition(entry.package, entry.baseDir, layer));
43
+ }
44
+ function getTenantLayers(context) {
45
+ const tenantRoot = getTenantRoot(context.tenantConfig, context.projectRoot);
46
+ const overrides = context.tenantConfig.overrides;
47
+ if (!overrides) {
48
+ return [];
49
+ }
50
+ const layers = [];
51
+ if (overrides.pagesRoot) {
52
+ layers.push({
53
+ owner: "tenant",
54
+ root: resolve(tenantRoot, overrides.pagesRoot),
55
+ kinds: ["pages"]
56
+ });
57
+ }
58
+ if (overrides.stylesRoot) {
59
+ layers.push({
60
+ owner: "tenant",
61
+ root: resolve(tenantRoot, overrides.stylesRoot),
62
+ kinds: ["styles"]
63
+ });
64
+ }
65
+ if (overrides.componentsRoot) {
66
+ layers.push({
67
+ owner: "tenant",
68
+ root: resolve(tenantRoot, overrides.componentsRoot),
69
+ kinds: ["components"]
70
+ });
71
+ }
72
+ return layers;
73
+ }
74
+ function buildTreeseedSiteLayers(pluginRuntime, context) {
75
+ const layers = [
76
+ {
77
+ owner: "@treeseed/core",
78
+ root: context.coreRoot,
79
+ kinds: [...TREESEED_SITE_RESOURCE_KINDS]
80
+ }
81
+ ];
82
+ for (const entry of pluginRuntime.plugins) {
83
+ layers.push(...getPluginLayers(entry, context));
84
+ }
85
+ layers.push(...getTenantLayers(context));
86
+ return layers;
87
+ }
88
+ function resolveTreeseedSiteResource(layers, kind, resourcePath) {
89
+ const normalizedPath = normalizeResourcePath(kind, resourcePath);
90
+ for (let index = layers.length - 1; index >= 0; index -= 1) {
91
+ const layer = layers[index];
92
+ if (!layer || !isKindSupported(layer, kind)) {
93
+ continue;
94
+ }
95
+ const candidate = resolve(layer.root, normalizedPath);
96
+ if (existsSync(candidate)) {
97
+ return candidate;
98
+ }
99
+ }
100
+ return null;
101
+ }
102
+ function resolveTreeseedPageEntrypoint(layers, resourcePath) {
103
+ const hasExplicitExtension = /\.[A-Za-z0-9]+$/u.test(resourcePath);
104
+ const candidates = hasExplicitExtension ? [resourcePath, `${resourcePath}.astro`, `${resourcePath}.ts`, `${resourcePath}.js`, `${resourcePath}.mjs`] : [resourcePath, `${resourcePath}.astro`, `${resourcePath}.ts`, `${resourcePath}.js`, `${resourcePath}.mjs`];
105
+ for (const candidate of candidates) {
106
+ const resolved = resolveTreeseedSiteResource(layers, "pages", candidate);
107
+ if (resolved) {
108
+ return resolved;
109
+ }
110
+ }
111
+ const normalized = hasExplicitExtension ? normalizeResourcePath("pages", resourcePath) : normalizeResourcePath("pages", `${resourcePath}.astro`);
112
+ throw new Error(`Unable to resolve Treeseed page resource "${normalized}".`);
113
+ }
114
+ function resolveTreeseedStyleEntrypoint(layers, resourcePath) {
115
+ const resolved = resolveTreeseedSiteResource(layers, "styles", resourcePath);
116
+ if (!resolved) {
117
+ throw new Error(`Unable to resolve Treeseed style resource "${normalizeResourcePath("styles", resourcePath)}".`);
118
+ }
119
+ return resolved;
120
+ }
121
+ export {
122
+ TREESEED_SITE_RESOURCE_KINDS,
123
+ buildTreeseedSiteLayers,
124
+ resolveTreeseedPageEntrypoint,
125
+ resolveTreeseedSiteResource,
126
+ resolveTreeseedStyleEntrypoint
127
+ };