@dogsbay/ssg 0.2.0-beta.149 → 0.2.0-beta.151.1

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.
@@ -1,4 +1,4 @@
1
- import { type ProductModel } from "@dogsbay/site-files";
1
+ import { type SiteChrome, type ProductModel } from "@dogsbay/site-files";
2
2
  export type LinkStyle = "html" | "pretty";
3
3
  export type TocMode = "top" | "popover" | "rail" | "off";
4
4
  export interface VersionDef {
@@ -99,7 +99,15 @@ export interface SiteConfig {
99
99
  basePath: string;
100
100
  repoUrl?: string;
101
101
  editUri?: string;
102
+ /** Inline Markdown (site-files `inlineMarkdownHtml`), as `chrome.copyright`. */
102
103
  copyright?: string;
104
+ /**
105
+ * The site's chrome, read and checked by site-files `siteChrome` for both pipelines: the logo,
106
+ * the first-visit colour mode, the announcement bar, header links and icons, footer columns and
107
+ * icons (`site.logo`, `site.colorMode`, `site.announcement`, `header:`, `footer:`). Its
108
+ * `warnings` are reported by the build. plans/site-chrome.md.
109
+ */
110
+ chrome: SiteChrome;
103
111
  linkStyle: LinkStyle;
104
112
  attributes: Record<string, unknown>;
105
113
  sources: SourceDef[];
@@ -372,8 +380,8 @@ export declare function projectPath(unit: BuildUnit, path: string): string;
372
380
  export declare const TOPIC_MAP: RegExp;
373
381
  /**
374
382
  * The project folders and files a build reads: every source's root, the theme folder, extra
375
- * stylesheets, the folder of each source's own nav file (a topic map's includes sit beside it), and
376
- * the data folders (the site's, and any source's own; one that does not exist is not read).
383
+ * stylesheets, the folder of each source's own nav file (a topic map's includes sit beside it), the
384
+ * data folders (the site's, and any source's own; one that does not exist is not read), and the logo files.
377
385
  * [""] when a source is the whole project. What the CLI reads from disk, and a dev session watches.
378
386
  */
379
387
  export declare function projectRoots(cfg: SiteConfig): string[];
@@ -0,0 +1,9 @@
1
+ /** An Iconify set name as a unit manifest may record it (the `icon-notices` table's keys are of this shape). */
2
+ export declare const ICON_SET_NAME: RegExp;
3
+ /**
4
+ * THIRD-PARTY-NOTICES.txt's section for the Iconify sets the pages drew from (`sets`, prefixes), or
5
+ * undefined when there is none to list. Lucide and MDI are listed with render-html's built-in icons in
6
+ * every site already. Pure, so a one-unit build lists the sets its stored units recorded too
7
+ * (plans/unit-publishing.md).
8
+ */
9
+ export declare function iconSetNotices(sets: Iterable<string>): string | undefined;
@@ -44,3 +44,11 @@ export declare function createResolver(table: LinkTable, page: {
44
44
  source: string;
45
45
  out: string;
46
46
  }): LinkResolver;
47
+ /**
48
+ * A versionMenu or site chrome link as a page writes it: an http(s) address as is; a site path from the page's
49
+ * site root (a leading `basePath` dropped, as redirects do), `/x/` as `x/index.html` and `/x` as
50
+ * `x.html` (a folder's index needs the slash), with pretty links as the site serves them (`x/`, `x`).
51
+ * A file (`.pdf`, `.html`, MENU_FILE) is kept. At the site root the link starts with `./`, so
52
+ * nothing in the path can read as a scheme.
53
+ */
54
+ export declare function menuHref(href: string, siteRoot: string, style: LinkStyle, basePath?: string): string;
@@ -117,5 +117,11 @@ export declare function splitSuffix(raw: string): {
117
117
  export declare function stubFile(rule: RedirectRule): string;
118
118
  /** A meta-refresh page, as `renderMetaRefreshPage`, with a relative target so it works from disk. */
119
119
  export declare function renderRedirectPage(rule: RedirectRule, cfg: SiteConfig): string;
120
+ /** A rule as the site serves it: `from` and `to` with the base path, `to` as its page is served. */
121
+ export declare function servedRedirect(r: RedirectRule, cfg: SiteConfig): {
122
+ from: string;
123
+ to: string;
124
+ status: number;
125
+ };
120
126
  /** _redirects (Cloudflare), as `renderRedirectsFile`, with served paths. */
121
127
  export declare function renderRedirectsFile(rules: RedirectRule[], cfg: SiteConfig): string;
@@ -0,0 +1,74 @@
1
+ /**
2
+ * A manifest per unit (plans/unit-publishing.md): what each unit's build leaves for the site-wide
3
+ * files, so one product, version or language can be built and published on its own and the
4
+ * `_redirects`, sitemap index and root forwards still cover every unit. The format is
5
+ * @dogsbay/site-files' `UnitManifest` (shared with the Dogsbay CLI), with our own `ssg` section.
6
+ * Written at `_dogsbay/units/<unitKeyString>.json` on sites with two or more units. Pure: the CLI
7
+ * and the Worker read the files and hand them to `build()` as `BuildInput.manifests`.
8
+ */
9
+ import { type UnitManifest } from "@dogsbay/site-files";
10
+ import type { BuildUnit } from "./config.js";
11
+ import type { RedirectInput } from "./site-files.js";
12
+ /** What a unit's build records for the next one-unit build or assemble. */
13
+ export interface SsgUnitData {
14
+ /** The unit's folder in the site ("" at the root). */
15
+ prefix: string;
16
+ /** Its redirects before they are resolved (front matter and aliases; config redirects come from the config). */
17
+ redirectInputs: RedirectInput[];
18
+ /** `[site path, output file]` of its pages, so other units' redirects resolve against them. */
19
+ pageOut: Array<[string, string]>;
20
+ /** Its sitemap files, for the sitemap index. */
21
+ sitemaps: string[];
22
+ /** The page its home forwards to, when it has no home page. */
23
+ homeForward?: string;
24
+ /** Every file it wrote, so the next publish of the unit can remove the ones it no longer writes. */
25
+ files: string[];
26
+ /** The client file its pages load (`_dogsbay/assets/<client>`). */
27
+ client: string;
28
+ /** The dogsbay-ssg version that built it. */
29
+ builder: string;
30
+ /** A page rendered math: the site keeps KaTeX's files and its notice. */
31
+ math?: boolean;
32
+ /** The Iconify sets its pages drew from, for THIRD-PARTY-NOTICES.txt (may list sets an earlier unit of the same build used). */
33
+ iconSets?: string[];
34
+ }
35
+ export type SsgUnitManifest = UnitManifest & {
36
+ ssg: SsgUnitData;
37
+ };
38
+ /** The unit's key, as site-files names a unit (`calico/_/3.32`). */
39
+ export declare function unitKey(u: Pick<BuildUnit, "product" | "locale" | "version">): string;
40
+ /** Where a unit's manifest is written, from the site root. */
41
+ export declare function manifestPath(u: Pick<BuildUnit, "product" | "locale" | "version">): string;
42
+ /** The folder the manifests sit in, from the site root. */
43
+ export declare const MANIFEST_DIR = "_dogsbay/units/";
44
+ export declare function makeManifest(u: BuildUnit, ssg: SsgUnitData, redirects: Array<[string, string, number]>): SsgUnitManifest;
45
+ /**
46
+ * A manifest read back (JSON text or a parsed value), checked: undefined, with a reason, when it is
47
+ * not one this build can use (another format, or written by something other than dogsbay-ssg).
48
+ */
49
+ export declare function parseManifest(raw: unknown): {
50
+ manifest?: SsgUnitManifest;
51
+ problem?: string;
52
+ };
53
+ /** The hashed client files (`dogsbay-<hash>.js`, in `_dogsbay/assets/`) an update removes when no unit loads them. */
54
+ export declare const CLIENT_PATTERN: RegExp;
55
+ /** What removing stale files needs of a manifest. */
56
+ export interface UnitFiles {
57
+ prefix: string;
58
+ files: string[];
59
+ client: string;
60
+ }
61
+ /** A manifest's `UnitFiles`, or null when the text is not a manifest this version can read. */
62
+ export declare function unitFilesOf(text: string): UnitFiles | null;
63
+ /**
64
+ * After a one-unit update, the files to remove (site paths). `previous` and `now` are the site's
65
+ * manifests before and after the build, by path (null: unreadable); a unit counts as rebuilt when this
66
+ * build wrote its manifest (`written` holds every path the build wrote).
67
+ * - A rebuilt unit's files its previous manifest listed and its new one does not (pages deleted or
68
+ * moved), unless this build wrote them, or they are not in that unit's own folder: the unit whose
69
+ * prefix is the longest to hold the path (a version at the root holds the others' folders), so a
70
+ * manifest can only ever remove files of its own unit.
71
+ * - The hashed clients in `assets` (file names) no manifest loads any more; none when a manifest
72
+ * cannot be read, since its pages may load one.
73
+ */
74
+ export declare function staleUnitFiles(previous: ReadonlyMap<string, UnitFiles | null>, now: ReadonlyMap<string, UnitFiles | null>, written: ReadonlySet<string>, assets: readonly string[]): string[];
@@ -1,4 +1,11 @@
1
1
  export declare const CLIENT_JS: string;
2
+ /**
3
+ * The name the pages load the client by, from its content (_dogsbay/assets/<CLIENT_FILE>): a unit built
4
+ * by another version of the client keeps loading its own (plans/unit-publishing.md).
5
+ */
6
+ export declare const CLIENT_FILE: string;
7
+ /** This package's version, recorded in each unit's manifest. */
8
+ export declare const SSG_VERSION: string;
2
9
  export declare const THEME_TEMPLATES: Record<string, string>;
3
10
  export declare const CLIENT_CANDIDATES: string[];
4
11
  /** _dogsbay/assets/THIRD-PARTY-NOTICES.txt: the client's packages and Tailwind (scripts/notices.mjs). */
@@ -0,0 +1,2 @@
1
+ /** Each Iconify set's attribution and licence (scripts/notices.mjs iconSetNotice), by prefix. */
2
+ export declare const ICON_SET_NOTICES: Record<string, string>;
@@ -89,6 +89,11 @@ export interface PageModel {
89
89
  math?: boolean;
90
90
  /** The page's front matter, for templates (`page.meta.*`). */
91
91
  meta?: Record<string, unknown>;
92
+ /** The site logo's files as the build wrote them, from the site root (`_dogsbay/site/logo-light.svg`); none without `site.logo` or when it was left out. */
93
+ logo?: {
94
+ light: string;
95
+ dark?: string;
96
+ };
92
97
  /** Search-engine and social metadata; see seo.ts. */
93
98
  seo?: Omit<SeoInput, "title" | "siteName" | "description" | "headings" | "tags" | "lastUpdated">;
94
99
  t: (k: string) => string;
@@ -100,4 +105,11 @@ export interface PageModel {
100
105
  * template can only read plain data.
101
106
  */
102
107
  export declare function plainData(v: unknown): unknown;
108
+ /**
109
+ * What a reader's close is stored under (`db-announcement-closed:<key>`): the id after the site's
110
+ * URL path and base path, as the Astro pipeline writes it (`/docs#launch-2026`), so sites on one
111
+ * host keep their own. Without either, the site's name: sites published under paths of the Worker,
112
+ * or opened from disk, share an origin too.
113
+ */
114
+ export declare function announcementKey(cfg: SiteConfig): string;
103
115
  export declare function composePage(p: PageModel, cfg: SiteConfig, templates: ThemeTemplates): Promise<string>;
@@ -0,0 +1,52 @@
1
+ /**
2
+ * The site's chrome as DocsLayout draws it: the `chrome` object format-astro writes into
3
+ * site.json (its `chromeData`), links already carrying the site's prefix, texts already HTML
4
+ * (@dogsbay/site-files inline Markdown), icons already SVG. dogsbay-ssg draws the same keys with
5
+ * its own markup and these classes. See plans/site-chrome.md.
6
+ */
7
+ export interface SiteChromeLink {
8
+ label: string;
9
+ href: string;
10
+ }
11
+ export interface SiteChromeMenu {
12
+ label: string;
13
+ items: SiteChromeLink[];
14
+ }
15
+ export interface SiteChromeSocial {
16
+ label: string;
17
+ href: string;
18
+ svg: string;
19
+ }
20
+ export interface SiteChromeData {
21
+ colorMode?: "light" | "dark" | "system";
22
+ logo?: {
23
+ light: string;
24
+ dark?: string;
25
+ alt: string;
26
+ replacesName: boolean;
27
+ };
28
+ /** `key` (format-astro): the stored id, with the site's prefix; older site.json files have only `id`. */
29
+ announcement?: {
30
+ id: string;
31
+ key?: string;
32
+ html: string;
33
+ tone: string;
34
+ closeable: boolean;
35
+ };
36
+ header?: {
37
+ links: Array<SiteChromeLink | SiteChromeMenu>;
38
+ social: SiteChromeSocial[];
39
+ };
40
+ footer?: {
41
+ columns: Array<{
42
+ title: string;
43
+ links: SiteChromeLink[];
44
+ }>;
45
+ social: SiteChromeSocial[];
46
+ };
47
+ }
48
+ export declare const isMenu: (l: SiteChromeLink | SiteChromeMenu) => l is SiteChromeMenu;
49
+ /** An http(s) address on another site: opened as the version menu's are, in the same tab, marked external for link icons. */
50
+ export declare const isExternal: (href: string) => boolean;
51
+ /** The announcement's colours by tone: the callout tokens, so the theme and dark mode apply. */
52
+ export declare const ANNOUNCEMENT_TONE_CLASS: Record<string, string>;
@@ -1,15 +1,19 @@
1
1
  import type { NavNode } from "../core/nav.js";
2
- /** Icons the region partials place (pager chevrons, the "Powered by" mark). */
2
+ /** Icons the region partials place (pager chevrons, the "Powered by" mark, the header menus' chevron, the announcement's close). */
3
3
  export declare const ICONS: {
4
+ chevronDown: string;
5
+ close: string;
4
6
  chevronLeft: string;
5
7
  chevronRight: string;
6
8
  layers: string;
7
9
  };
8
10
  export declare const BOOK_ICON: string;
11
+ /** `links`: the header's links as a list, shown here below lg (DocsLayout's SidebarGroup with HeaderLinks layout="list"). */
9
12
  export declare function sidebar(opts: {
10
13
  header: string;
11
14
  nav: string;
12
15
  label: string;
16
+ links?: string;
13
17
  }): string;
14
18
  export declare function sidebarTrigger(label: string): string;
15
19
  export interface NavOptions {
@@ -52,7 +56,6 @@ export declare function compactNav(nodes: NavNode[], href: (slug: string) => str
52
56
  export declare function navSize(nodes: NavNode[]): number;
53
57
  export declare function searchButton(label: string): string;
54
58
  export declare function themeToggle(label: string): string;
55
- export declare function repoLink(url: string, label: string): string;
56
59
  export interface SwitchOption {
57
60
  label: string;
58
61
  href: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dogsbay/ssg",
3
- "version": "0.2.0-beta.149",
3
+ "version": "0.2.0-beta.151.1",
4
4
  "type": "module",
5
5
  "description": "Documentation static site generator for Dogsbay-MD that builds inside Cloudflare Workers and publishes sites that work offline",
6
6
  "license": "Apache-2.0",
@@ -49,38 +49,38 @@
49
49
  "tailwindcss": "^4.3.2"
50
50
  },
51
51
  "peerDependencies": {
52
- "@dogsbay/elements": "0.2.0-beta.149",
53
- "@dogsbay/format-dogsbay-md": "0.2.0-beta.149",
54
- "@dogsbay/format-openapi": "0.2.0-beta.149",
55
- "@dogsbay/format-topicmap": "0.2.0-beta.149",
56
- "@dogsbay/highlight": "0.2.0-beta.149",
57
- "@dogsbay/minja": "0.2.0-beta.149",
58
- "@dogsbay/primitives": "0.2.0-beta.149",
59
- "@dogsbay/render-html": "0.2.0-beta.149",
60
- "@dogsbay/search": "0.2.0-beta.149",
61
- "@dogsbay/serialize-core": "0.2.0-beta.149",
62
- "@dogsbay/site-check": "0.2.0-beta.149",
63
- "@dogsbay/site-files": "0.2.0-beta.149",
64
- "@dogsbay/types": "0.2.0-beta.149"
52
+ "@dogsbay/elements": "0.2.0-beta.151",
53
+ "@dogsbay/format-dogsbay-md": "0.2.0-beta.151",
54
+ "@dogsbay/format-openapi": "0.2.0-beta.151",
55
+ "@dogsbay/format-topicmap": "0.2.0-beta.151",
56
+ "@dogsbay/highlight": "0.2.0-beta.151",
57
+ "@dogsbay/minja": "0.2.0-beta.151",
58
+ "@dogsbay/primitives": "0.2.0-beta.151",
59
+ "@dogsbay/render-html": "0.2.0-beta.151",
60
+ "@dogsbay/search": "0.2.0-beta.151",
61
+ "@dogsbay/serialize-core": "0.2.0-beta.151",
62
+ "@dogsbay/site-check": "0.2.0-beta.151",
63
+ "@dogsbay/site-files": "0.2.0-beta.151",
64
+ "@dogsbay/types": "0.2.0-beta.151"
65
65
  },
66
66
  "devDependencies": {
67
67
  "@axe-core/playwright": "^4.12.1",
68
68
  "@cloudflare/workers-types": "^5.20260921.1",
69
- "@dogsbay/elements": "0.2.0-beta.149",
70
- "@dogsbay/format-dogsbay-md": "0.2.0-beta.149",
71
- "@dogsbay/format-openapi": "0.2.0-beta.149",
72
- "@dogsbay/format-topicmap": "0.2.0-beta.149",
73
- "@dogsbay/highlight": "0.2.0-beta.149",
74
- "@dogsbay/icons": "0.2.0-beta.149",
75
- "@dogsbay/minja": "0.2.0-beta.149",
76
- "@dogsbay/primitives": "0.2.0-beta.149",
77
- "@dogsbay/render-html": "0.2.0-beta.149",
78
- "@dogsbay/search": "0.2.0-beta.149",
79
- "@dogsbay/serialize-core": "0.2.0-beta.149",
80
- "@dogsbay/site-check": "0.2.0-beta.149",
81
- "@dogsbay/site-files": "0.2.0-beta.149",
82
- "@dogsbay/types": "0.2.0-beta.149",
83
- "@dogsbay/ui": "0.2.0-beta.149",
69
+ "@dogsbay/elements": "0.2.0-beta.151",
70
+ "@dogsbay/format-dogsbay-md": "0.2.0-beta.151",
71
+ "@dogsbay/format-openapi": "0.2.0-beta.151",
72
+ "@dogsbay/format-topicmap": "0.2.0-beta.151",
73
+ "@dogsbay/highlight": "0.2.0-beta.151",
74
+ "@dogsbay/icons": "0.2.0-beta.151",
75
+ "@dogsbay/minja": "0.2.0-beta.151",
76
+ "@dogsbay/primitives": "0.2.0-beta.151",
77
+ "@dogsbay/render-html": "0.2.0-beta.151",
78
+ "@dogsbay/search": "0.2.0-beta.151",
79
+ "@dogsbay/serialize-core": "0.2.0-beta.151",
80
+ "@dogsbay/site-check": "0.2.0-beta.151",
81
+ "@dogsbay/site-files": "0.2.0-beta.151",
82
+ "@dogsbay/types": "0.2.0-beta.151",
83
+ "@dogsbay/ui": "0.2.0-beta.151",
84
84
  "@mermanjs/web": "0.7.0",
85
85
  "@playwright/test": "1.61.1",
86
86
  "@types/node": "^22.10.0",