Skip to content

@xtandard/kit/site

@xtandard/kit/site — the docs-site tooling shared by the xtandard products (Astro Starlight over the repository’s Markdown, plus a TypeDoc API reference):

  • defineSiteManifest: the information architecture (pages, sidebar, pending guides) and apiEntries() (one module per exports entry);
  • syncSite / runSync: the pre-build step that writes site/src/content/docs/;
  • defineXtandardSite: the Astro config (Starlight, starlight-typedoc, Mermaid, links validator, head tags);
  • createTypedocPlugin and apiOverviews: the API reference’s named return types, re-export lists and overview pages.

Optional peers, loaded from the site’s own install: astro, @astrojs/starlight, starlight-typedoc, typedoc, typescript, astro-mermaid, starlight-links-validator.

import { … } from "@xtandard/kit/site";
Name Summary
alerts GitHub alerts (> [!WARNING] + quoted lines) → Starlight asides (:::caution).
apiEntries Every public entry point of the package at repoRoot, in exports order. Skips stylesheets, wildcards, JSON and ./package.json. A subpath maps to src/entry-<subpath with dashes>.ts when that file exists, otherwise to src/<subpath>.ts(x); the root maps to src/index.ts.
apiOverviews The overview-pages plugin; add it after starlight-typedoc (plugins run in order).
createTypedocPlugin Create the TypeDoc plugin for the site at siteDir. Pass the returned function in TypeDoc’s plugin option (TypeDoc 0.26+ accepts plugin functions and awaits them).
defineSiteManifest Resolve a site manifest from the product’s options.
defineXtandardSite Build the site’s Astro config.
describeMarkdown The first paragraph of prose, as a meta description of at most ~200 characters.
importFromSite Import package name as installed for the site at siteDir; when the site doesn’t have it, fall back to a plain import() from the kit (and a clear “install it” error when that fails).
isGroup Whether a sidebar item is a group.
isPage Whether a sidebar item is a page.
loadSiteModules Import the site’s typedoc and typescript (the instances starlight-typedoc uses).
mapProse Calls fn on each line outside fenced code blocks; code lines are kept as they are.
moduleDescription A module’s leading doc comment, without the Import from line and the tags; {@link}s become code spans.
orderedEntryPoints The API entry files in documentation order: apiOwners first (a symbol exported by several entry points is documented under the first one TypeDoc meets), then the rest alphabetically — a fixed order, since a glob’s order differs between file systems. Throws when an owner is not an entry point.
plain Plain text of a Markdown inline string (titles, descriptions, heading slugs).
readReexports Read the re-exports the plugin recorded for a site ([] before the first API build).
reexportsFile Where the plugin writes, and apiOverviews reads, the re-exports of a site.
resolvePackageEntry The ESM entry file of package name as installed for fromDir (looking in node_modules from fromDir upwards), or undefined when it isn’t installed there.
runSync Run syncSite and print the outcome; resolves to the exit code (the sync script’s).
syncSite Write site/src/content/docs/ and site/public/ from the manifest.
toStarlightSidebar The manifest’s sidebar as Starlight sidebar entries.
writeApiOverviews Write index.md for /api/ and each /api/<module>/ under apiDir (starlight-typedoc’s output). Resolves to the number of modules.
Name Summary
Slugger GitHub’s heading anchors (github-slugger): lowercase, punctuation and symbols removed, spaces to -, repeats suffixed -1, -2…
Name Summary
ApiEntry A public entry point: its API reference module, import specifier and source file.
ApiOverviewsOptions Options for apiOverviews.
Reexport A re-export: name in module module is documented in owner as the kind member target (a different name for a renamed or default export).
SiteGroup A sidebar group.
SiteLink An external sidebar link.
SiteManifest A resolved site manifest.
SiteManifestOptions Options for defineSiteManifest.
SitePage One page of the site.
SitePeers The integrations defineXtandardSite uses.
SyncResult What syncSite did.
TypedocPluginOptions Options for createTypedocPlugin.
XtandardSiteOptions Options for defineXtandardSite.
Name Summary
IntegrationFactory
SiteItem A sidebar item.
StarlightSidebarItem A Starlight sidebar entry.