@dogsbay/format-astro 0.2.0-beta.16 → 0.2.0-beta.160
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api-markdown.d.ts +7 -0
- package/dist/api-markdown.js +49 -0
- package/dist/base-path.d.ts +93 -8
- package/dist/base-path.js +122 -9
- package/dist/blog.d.ts +133 -0
- package/dist/blog.js +325 -0
- package/dist/browser.d.ts +13 -0
- package/dist/browser.js +13 -0
- package/dist/canonical.d.ts +35 -0
- package/dist/canonical.js +110 -0
- package/dist/capabilities.d.ts +28 -0
- package/dist/capabilities.js +94 -0
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +3 -1
- package/dist/diff-decoration.d.ts +35 -0
- package/dist/diff-decoration.js +101 -0
- package/dist/granularity.d.ts +82 -0
- package/dist/granularity.js +246 -0
- package/dist/head-metadata.d.ts +25 -0
- package/dist/head-metadata.js +55 -0
- package/dist/index.d.ts +26 -6
- package/dist/index.js +34 -5
- package/dist/lead.d.ts +1 -39
- package/dist/lead.js +3 -38
- package/dist/llms-txt.d.ts +47 -11
- package/dist/llms-txt.js +83 -275
- package/dist/plugins.d.ts +0 -1
- package/dist/plugins.js +4 -3
- package/dist/project.d.ts +502 -13
- package/dist/project.js +2506 -697
- package/dist/redirects.d.ts +117 -0
- package/dist/redirects.js +223 -0
- package/dist/serialize.d.ts +14 -14
- package/dist/serialize.js +908 -270
- package/dist/site-chrome.d.ts +62 -0
- package/dist/site-chrome.js +56 -0
- package/dist/sitemap.d.ts +62 -4
- package/dist/sitemap.js +63 -56
- package/dist/taxonomy.d.ts +48 -2
- package/dist/taxonomy.js +50 -12
- package/dist/theme-css.d.ts +33 -0
- package/dist/theme-css.js +686 -0
- package/dist/tone-classes.d.ts +52 -0
- package/dist/tone-classes.js +84 -0
- package/dist/write-if-changed.d.ts +20 -0
- package/dist/write-if-changed.js +57 -0
- package/package.json +17 -7
- package/dist/base-path.d.ts.map +0 -1
- package/dist/base-path.js.map +0 -1
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lead.d.ts.map +0 -1
- package/dist/lead.js.map +0 -1
- package/dist/llms-txt.d.ts.map +0 -1
- package/dist/llms-txt.js.map +0 -1
- package/dist/plugins.d.ts.map +0 -1
- package/dist/plugins.js.map +0 -1
- package/dist/project.d.ts.map +0 -1
- package/dist/project.js.map +0 -1
- package/dist/serialize.d.ts.map +0 -1
- package/dist/serialize.js.map +0 -1
- package/dist/sitemap.d.ts.map +0 -1
- package/dist/sitemap.js.map +0 -1
- package/dist/taxonomy.d.ts.map +0 -1
- package/dist/taxonomy.js.map +0 -1
package/dist/project.d.ts
CHANGED
|
@@ -1,4 +1,44 @@
|
|
|
1
1
|
import type { ExportPage, NavItem } from "@dogsbay/types";
|
|
2
|
+
import { type MarkdownStyle } from "@dogsbay/format-dogsbay-md";
|
|
3
|
+
import { type SiteChrome } from "@dogsbay/site-files";
|
|
4
|
+
import { type VersionMenu, type ProductModel } from "@dogsbay/site-files";
|
|
5
|
+
import { type BlogEmitConfig } from "./blog.js";
|
|
6
|
+
import { type RedirectsConfig } from "./redirects.js";
|
|
7
|
+
/**
|
|
8
|
+
* Astro `outDir` for a Cloudflare Workers deploy mounted on a host subpath.
|
|
9
|
+
*
|
|
10
|
+
* Workers Static Assets resolves the FULL request pathname against the
|
|
11
|
+
* asset manifest and strips nothing. A site mounted at `dogsbay.ai/blog/*`
|
|
12
|
+
* is therefore asked for `/blog/index.html`, and unless the build output
|
|
13
|
+
* actually contains `blog/`, every request 404s. Astro's `base` does not
|
|
14
|
+
* do this: it prefixes generated URLs (including `/blog/_astro/...`) but
|
|
15
|
+
* leaves the emitted files at `dist/` root. Setting `outDir` to
|
|
16
|
+
* `./dist<urlBase>` is what makes the two agree.
|
|
17
|
+
*
|
|
18
|
+
* GitHub Pages needs the OPPOSITE and must not get this. There the
|
|
19
|
+
* uploaded artifact IS the site root, served at `https://<user>.github.io/
|
|
20
|
+
* <repo>/`, so the host supplies the prefix: URLs must carry it, files
|
|
21
|
+
* must not. Emitting `outDir` for a Pages build would produce
|
|
22
|
+
* `/<repo>/<repo>/`. Hence the deploy-target gate — the same `site.url`
|
|
23
|
+
* deliberately yields different layouts per target.
|
|
24
|
+
*
|
|
25
|
+
* Returns `undefined` when the target is not Workers or the site sits at
|
|
26
|
+
* the host root (no path in `site.url`), which is the common case.
|
|
27
|
+
*/
|
|
28
|
+
export declare function workersSubpathOutDir(deploy: AstroProjectOptions["deploy"], urlBase: string): string | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Build the `excludeFromRoutes` predicate.
|
|
31
|
+
*
|
|
32
|
+
* Exported because more than one emitter has to agree on which pages
|
|
33
|
+
* become routes. The blog listed excluded pages as posts, producing index
|
|
34
|
+
* cards and Newer/Older links to pages that were never emitted — a 404
|
|
35
|
+
* from the site's own front page.
|
|
36
|
+
*
|
|
37
|
+
* A single-segment pattern matches ANY segment (fragment dirs symlink to
|
|
38
|
+
* many depths in AsciiBinder corpora); a multi-segment pattern matches as
|
|
39
|
+
* a leading path prefix, so `welcome/_internal` excludes only that tree.
|
|
40
|
+
*/
|
|
41
|
+
export declare function makeSlugExcluder(excludeFromRoutes?: string[]): (slug: string) => boolean;
|
|
2
42
|
export interface AstroProjectOptions {
|
|
3
43
|
siteName?: string;
|
|
4
44
|
theme?: string;
|
|
@@ -6,13 +46,78 @@ export interface AstroProjectOptions {
|
|
|
6
46
|
repoUrl?: string;
|
|
7
47
|
editUri?: string;
|
|
8
48
|
copyright?: string;
|
|
49
|
+
/**
|
|
50
|
+
* The site's chrome (@dogsbay/site-files `siteChrome`: logo, colour mode, announcement, header
|
|
51
|
+
* links, footer columns), written into site.json as `chrome`. With it, `copyright` is inline
|
|
52
|
+
* Markdown (the agreed rule); without it (legacy callers), copyright stays HTML as given.
|
|
53
|
+
*/
|
|
54
|
+
chrome?: SiteChrome;
|
|
55
|
+
/** The chrome's logo files, absolute, checked inside the project by the caller. */
|
|
56
|
+
chromeLogoFiles?: {
|
|
57
|
+
light: string;
|
|
58
|
+
dark?: string;
|
|
59
|
+
};
|
|
60
|
+
/** The line under the site name in the sidebar header (`site.tagline`). Default "Documentation". */
|
|
61
|
+
tagline?: string;
|
|
62
|
+
/** `content.imageCaptions`: a titled block image is a captioned figure. */
|
|
63
|
+
imageCaptions?: "title" | false;
|
|
64
|
+
/** `content.html`: "sanitize" filters raw HTML and directive attributes before serializing (@dogsbay/render-html/sanitize). */
|
|
65
|
+
html?: "keep" | "sanitize";
|
|
66
|
+
/**
|
|
67
|
+
* "Powered by DogsBay" footer attribution. Default ON — an unset value
|
|
68
|
+
* means true. `poweredBy: false` in dogsbay.config.yml removes it, and
|
|
69
|
+
* removes it completely: no markup, no link, no trace. See
|
|
70
|
+
* docs/powered-by.md.
|
|
71
|
+
*/
|
|
72
|
+
poweredBy?: boolean;
|
|
9
73
|
/**
|
|
10
74
|
* Brand keywords for the site. Emitted into `src/data/site.json`
|
|
11
75
|
* so the `seo/h1-brand-keyword` audit rule can read them.
|
|
12
76
|
*/
|
|
13
77
|
brandKeywords?: string[];
|
|
78
|
+
/**
|
|
79
|
+
* Site-wide noindex. When true, every emitted page passes
|
|
80
|
+
* `noindex={true}` to DocsLayout regardless of frontmatter, and
|
|
81
|
+
* the sitemap emits zero `<url>` entries. Pages can ESCALATE
|
|
82
|
+
* (frontmatter `noindex: true` still works) but not opt out.
|
|
83
|
+
* See plans/site-level-robots-meta.md.
|
|
84
|
+
*/
|
|
85
|
+
noindex?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Site-wide nofollow. Same one-way semantics as `noindex` — site
|
|
88
|
+
* forces, page frontmatter `nofollow: true` can escalate but
|
|
89
|
+
* cannot opt out. Independent of `noindex`.
|
|
90
|
+
*/
|
|
91
|
+
nofollow?: boolean;
|
|
14
92
|
/** Source project directory (for copying extra_css, assets, etc.) */
|
|
15
93
|
sourceDir?: string;
|
|
94
|
+
/**
|
|
95
|
+
* External asset directories mounted into the `_assets` convention. Each
|
|
96
|
+
* dir's CONTENTS are copied to `public/_assets/` (e.g. a Docusaurus `static/`
|
|
97
|
+
* dir, whose `/img/x` refs the importer rewrote to `/_assets/img/x`).
|
|
98
|
+
* `into` targets an `_assets/<into>` subdir; `mediaOnly` copies only media
|
|
99
|
+
* files (for mounts whose dir is the docs tree itself).
|
|
100
|
+
*/
|
|
101
|
+
assetMounts?: {
|
|
102
|
+
dir: string;
|
|
103
|
+
into?: string;
|
|
104
|
+
mediaOnly?: boolean;
|
|
105
|
+
root?: string;
|
|
106
|
+
skip?: string[];
|
|
107
|
+
}[];
|
|
108
|
+
/**
|
|
109
|
+
* Per-source asset directories with the URL prefix their content refs
|
|
110
|
+
* were rewritten with. Used by multi-source (versioned/localised) builds
|
|
111
|
+
* so EACH source's assets are copied under `public/<urlPrefix>/...`
|
|
112
|
+
* (e.g. `public/8.8/_assets/...`) and same-path images across versions
|
|
113
|
+
* don't collide. When set, it REPLACES the single-`sourceDir` asset copy
|
|
114
|
+
* (which only ever copied the first source, version-less). `urlPrefix`
|
|
115
|
+
* empty/absent copies to `public/...` flat (the baseline source).
|
|
116
|
+
*/
|
|
117
|
+
assetSourceDirs?: {
|
|
118
|
+
dir: string;
|
|
119
|
+
urlPrefix?: string;
|
|
120
|
+
}[];
|
|
16
121
|
/** Custom CSS files from mkdocs.yml extra_css */
|
|
17
122
|
extraCss?: string[];
|
|
18
123
|
/** Enable Astro image optimization (copies to src/assets/ instead of public/) */
|
|
@@ -49,6 +154,8 @@ export interface AstroProjectOptions {
|
|
|
49
154
|
* `taxonomies.tags.labels`. URLs continue to use slugs.
|
|
50
155
|
*/
|
|
51
156
|
tagLabels?: import("@dogsbay/types").SiteConfig["tagLabels"];
|
|
157
|
+
/** Automatic chip colors. Sourced from `taxonomies.tags.autoColor`. */
|
|
158
|
+
tagAutoColor?: import("@dogsbay/types").SiteConfig["tagAutoColor"];
|
|
52
159
|
/**
|
|
53
160
|
* Map of taxonomy name → index path, sourced from declared
|
|
54
161
|
* `taxonomies` entries. Lets renderer components surface a link
|
|
@@ -63,6 +170,12 @@ export interface AstroProjectOptions {
|
|
|
63
170
|
* See plans/search-facets.md.
|
|
64
171
|
*/
|
|
65
172
|
taxonomyDisplay?: import("@dogsbay/types").SiteConfig["taxonomyDisplay"];
|
|
173
|
+
/**
|
|
174
|
+
* Declared taxonomies with `hierarchical: true`: a page's nested value in one
|
|
175
|
+
* of them is a search facet at every level (`ai/llm` → `ai`, `ai/llm`), as
|
|
176
|
+
* `pageFacets` (@dogsbay/site-files) maps it for DocsLayout and dogsbay-ssg.
|
|
177
|
+
*/
|
|
178
|
+
hierarchicalTaxonomies?: string[];
|
|
66
179
|
/** Canonical site URL — required for sitemap.xml + canonical tags */
|
|
67
180
|
siteUrl?: string;
|
|
68
181
|
/** Site-wide description used as default <meta name="description"> */
|
|
@@ -91,13 +204,51 @@ export interface AstroProjectOptions {
|
|
|
91
204
|
id: string;
|
|
92
205
|
label?: string;
|
|
93
206
|
eol?: boolean;
|
|
207
|
+
prerelease?: boolean;
|
|
208
|
+
hidden?: boolean;
|
|
209
|
+
canonical?: "self";
|
|
210
|
+
noindex?: boolean;
|
|
211
|
+
sitemap?: boolean;
|
|
212
|
+
badge?: boolean;
|
|
213
|
+
path?: "";
|
|
94
214
|
}>;
|
|
215
|
+
/**
|
|
216
|
+
* Units whose home has no page, forwarded to their first page (site-files `homeForwards`):
|
|
217
|
+
* `[from, to]` site paths without the base path, written as redirects.
|
|
218
|
+
*/
|
|
219
|
+
homeForwards?: Array<[string, string]>;
|
|
220
|
+
/** Leave out a redirect the build cannot honour, with a warning, instead of failing. */
|
|
221
|
+
allowBrokenRedirects?: boolean;
|
|
222
|
+
/**
|
|
223
|
+
* The version menu's links and limit (`content.versionMenu`, @dogsbay/site-files
|
|
224
|
+
* version-menu.ts). With a `products:` block each product's comes from the model.
|
|
225
|
+
*/
|
|
226
|
+
versionMenu?: VersionMenu;
|
|
95
227
|
/**
|
|
96
228
|
* Which version is the default. Marked in switcherMap.json so
|
|
97
|
-
* the switcher can highlight it
|
|
98
|
-
*
|
|
229
|
+
* the switcher can highlight it, and drives the default-version
|
|
230
|
+
* redirect middleware. A pre-release version is never the
|
|
231
|
+
* default (enforced at config load).
|
|
99
232
|
*/
|
|
100
233
|
defaultVersion?: string;
|
|
234
|
+
/**
|
|
235
|
+
* With a `products:` block: the model from @dogsbay/site-files
|
|
236
|
+
* (`productModel`). Each product's own versions and default then drive
|
|
237
|
+
* canonicals, the version switcher (`productVersions`), the forward from
|
|
238
|
+
* a product's root to its default version, and the data files
|
|
239
|
+
* `_dogsbay/versions.js` and `<unit home>_dogsbay/pages.js`.
|
|
240
|
+
*/
|
|
241
|
+
products?: ProductModel;
|
|
242
|
+
/**
|
|
243
|
+
* The project's own `_headers` / `_redirects` (from the root of a source served at the site
|
|
244
|
+
* root): written first, the generated rules after, generated ones they already decide left out
|
|
245
|
+
* (@dogsbay/site-files host-files.ts, as dogsbay-ssg does). With its own `_redirects` the file is
|
|
246
|
+
* written whatever `deploy` says, since the project's host reads it.
|
|
247
|
+
*/
|
|
248
|
+
hostFiles?: {
|
|
249
|
+
headers?: string;
|
|
250
|
+
redirects?: string;
|
|
251
|
+
};
|
|
101
252
|
/**
|
|
102
253
|
* Declared locales for the i18n axis. Same role as
|
|
103
254
|
* `versions` for the locale axis.
|
|
@@ -112,12 +263,89 @@ export interface AstroProjectOptions {
|
|
|
112
263
|
*/
|
|
113
264
|
defaultLocale?: string;
|
|
114
265
|
/**
|
|
115
|
-
* When set, emit
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
266
|
+
* When set, emit deploy artifacts for the named platform.
|
|
267
|
+
*
|
|
268
|
+
* - `"cloudflare-workers"` — `wrangler.jsonc` + `wrangler` devDep +
|
|
269
|
+
* `deploy` script.
|
|
270
|
+
* - `"github-pages"` — `.github/workflows/deploy.yml` (Astro →
|
|
271
|
+
* `actions/deploy-pages` workflow) + `public/.nojekyll`.
|
|
272
|
+
*
|
|
273
|
+
* Both targets scaffold their files write-if-missing — re-running
|
|
274
|
+
* the build never clobbers an author-edited workflow YAML or
|
|
275
|
+
* wrangler config.
|
|
276
|
+
*/
|
|
277
|
+
/**
|
|
278
|
+
* Other sites on this host whose sitemap / llms.txt this site
|
|
279
|
+
* aggregates. See `AggregateSource` in `@dogsbay/cli` and
|
|
280
|
+
* plans/subpath-robots-txt.md.
|
|
281
|
+
*/
|
|
282
|
+
aggregates?: {
|
|
283
|
+
name: string;
|
|
284
|
+
description?: string;
|
|
285
|
+
url?: string;
|
|
286
|
+
sitemap?: string;
|
|
287
|
+
llmsTxt?: string;
|
|
288
|
+
}[];
|
|
289
|
+
deploy?: "cloudflare-workers" | "github-pages";
|
|
290
|
+
/**
|
|
291
|
+
* `redirects:` from dogsbay.config.yml — source path → target, or an object
|
|
292
|
+
* with a status. Merged with `redirect:` / `aliases:` page frontmatter and
|
|
293
|
+
* emitted per deploy target. See plans/redirects-and-aliases.md.
|
|
294
|
+
*/
|
|
295
|
+
redirects?: RedirectsConfig;
|
|
296
|
+
/**
|
|
297
|
+
* Astro `build.inlineStylesheets` policy.
|
|
298
|
+
*
|
|
299
|
+
* - `"auto"` (default): inline only stylesheets below 4 KB,
|
|
300
|
+
* externalize the rest. Best for multi-page sites.
|
|
301
|
+
* - `"always"`: inline every stylesheet. Best for single-page
|
|
302
|
+
* sites where first-paint latency dominates.
|
|
303
|
+
* - `"never"`: always externalize. Maximizes cache reuse.
|
|
304
|
+
*
|
|
305
|
+
* Mirrors `dogsbay.config.yml`'s `build.inlineStylesheets`. Flows
|
|
306
|
+
* through `astro.config.dogsbay.mjs` so changes propagate without
|
|
307
|
+
* a scaffold rebuild. See docs/perf-tuning.md.
|
|
308
|
+
*/
|
|
309
|
+
inlineStylesheets?: "auto" | "always" | "never";
|
|
310
|
+
/**
|
|
311
|
+
* Sidebar navigation render mode.
|
|
312
|
+
*
|
|
313
|
+
* - `"client"` (default): emit `<DocsNavClient />` — an empty placeholder
|
|
314
|
+
* that a tiny client script hydrates from `/_dogsbay/nav.json`.
|
|
315
|
+
* Page HTML stays small regardless of nav size; the nav DOM persists
|
|
316
|
+
* across view transitions. Trade-off: no-JS users see no sidebar
|
|
317
|
+
* nav, search-engine crawlers reach pages via `sitemap.xml` and
|
|
318
|
+
* in-content links rather than the sidebar.
|
|
319
|
+
* - `"ssr-full"`: render the full nav tree into every page's HTML.
|
|
320
|
+
* Best for tiny sites or strict no-JS / SEO contexts.
|
|
321
|
+
*
|
|
322
|
+
* See plans/client-rendered-nav.md.
|
|
323
|
+
*/
|
|
324
|
+
navMode?: "client" | "ssr-full";
|
|
325
|
+
/**
|
|
326
|
+
* Table-of-contents placement — forwarded to DocsLayout's `toc` prop.
|
|
327
|
+
* Mirrors `DogsbayConfig.toc`:
|
|
328
|
+
* - `"top"` (default) — expandable "On this page" at the top of the
|
|
329
|
+
* article; frees the right rail for plugin content (e.g. Ask AI).
|
|
330
|
+
* - `"popover"` — an "On this page" control in the header.
|
|
331
|
+
* - `"rail"` — the classic right-hand TOC sidebar. In this mode the rail
|
|
332
|
+
* belongs to the TOC, so the `RightRail` plugin region is not emitted.
|
|
333
|
+
* - `"off"` — no table of contents.
|
|
334
|
+
*/
|
|
335
|
+
toc?: "top" | "popover" | "rail" | "off";
|
|
336
|
+
/**
|
|
337
|
+
* Repo root — the directory containing `dogsbay.config.yml`. The
|
|
338
|
+
* Astro project (`outputDir`) is typically a subdirectory like
|
|
339
|
+
* `<projectDir>/astro/`. Deploy artifacts that GitHub Actions
|
|
340
|
+
* needs at the repo root (`.github/workflows/deploy.yml`) are
|
|
341
|
+
* written here, while artifacts that ship inside the Astro build
|
|
342
|
+
* (e.g. `public/.nojekyll`) stay under `outputDir`.
|
|
343
|
+
*
|
|
344
|
+
* When unset, defaults to `outputDir` — covers flat-layout flows
|
|
345
|
+
* (`dogsbay convert --to astro`) where the Astro project IS the
|
|
346
|
+
* repo. site-init and site-build always pass it explicitly.
|
|
119
347
|
*/
|
|
120
|
-
|
|
348
|
+
projectDir?: string;
|
|
121
349
|
/**
|
|
122
350
|
* Overwrite all files including maintainer-customizable scaffold
|
|
123
351
|
* files (theme.css, astro.config.mjs, package.json, site.json,
|
|
@@ -143,6 +371,42 @@ export interface AstroProjectOptions {
|
|
|
143
371
|
* to static `.md` files in `dist/`. Default `true`.
|
|
144
372
|
*/
|
|
145
373
|
mdMirror?: boolean;
|
|
374
|
+
/**
|
|
375
|
+
* Where links in the Markdown copies (each `.md` and llms-full.txt) go: `html` (default), the
|
|
376
|
+
* page as the site serves it, so a person follows what an agent quotes; `md`, a page's `.md`
|
|
377
|
+
* copy (links to anything without one stay as they are). Absolute with `siteUrl`. Same key and
|
|
378
|
+
* meaning as dogsbay-ssg's `agent.mdMirrorLinks` (plans/md-mirror-links.md).
|
|
379
|
+
*/
|
|
380
|
+
mdMirrorLinks?: "html" | "md";
|
|
381
|
+
/** Write llms-full.txt. Default true; off with `mdMirror: false` too (as dogsbay-ssg). */
|
|
382
|
+
llmsFull?: boolean;
|
|
383
|
+
/** How the Markdown copies are written: the site's `style:` (dogsbay.config.yml). */
|
|
384
|
+
markdownStyle?: MarkdownStyle;
|
|
385
|
+
/**
|
|
386
|
+
* Granularity views — emit aggregate "single-page" views alongside the
|
|
387
|
+
* topic-grained pages. Additive: the topic site is unchanged; aggregates
|
|
388
|
+
* are quarantined (noindex + excludeFromSearch → robots/sitemap/pagefind/
|
|
389
|
+
* llms all exclude them) and kept out of nav. See plans/granularity-views.md.
|
|
390
|
+
*
|
|
391
|
+
* Per-node opt-in via the nav file's `single-page: yes | no | children`
|
|
392
|
+
* annotation (default "no"). `book: true` is the legacy all-on switch: it
|
|
393
|
+
* seeds the top-level groups as if each were `single-page: yes`, so a node's
|
|
394
|
+
* own annotation still overrides. `maxSinglePageMB` (default 3) is a safety
|
|
395
|
+
* cap — a rollup whose source exceeds it is skipped with a warning instead of
|
|
396
|
+
* building a multi-minute / multi-MB page. See plans/granularity-views.md and
|
|
397
|
+
* docs-dev/granularity-book-perf.md.
|
|
398
|
+
*/
|
|
399
|
+
granularity?: {
|
|
400
|
+
book?: boolean;
|
|
401
|
+
maxSinglePageMB?: number;
|
|
402
|
+
};
|
|
403
|
+
/**
|
|
404
|
+
* Blog mode. When set, every emitted page wears `chrome="blog"` (no
|
|
405
|
+
* sidebar), carries a byline, and takes its prev/next from DATE order
|
|
406
|
+
* rather than nav order. The reverse-chron index itself is emitted
|
|
407
|
+
* separately by `emitBlogFiles`. See plans/blog-capability.md.
|
|
408
|
+
*/
|
|
409
|
+
blog?: BlogEmitConfig;
|
|
146
410
|
/**
|
|
147
411
|
* `Content-Signal` directive for the AI training corpus permission
|
|
148
412
|
* emitted in robots.txt. Default `"no"` — opt out of training by
|
|
@@ -160,6 +424,22 @@ export interface AstroProjectOptions {
|
|
|
160
424
|
* search results emitted in robots.txt. Default `"yes"`.
|
|
161
425
|
*/
|
|
162
426
|
aiSearch?: "yes" | "no";
|
|
427
|
+
/**
|
|
428
|
+
* Emit the Article 4 reservation-of-rights preamble above the
|
|
429
|
+
* `Content-Signal` line in robots.txt. Default `false`.
|
|
430
|
+
* See `CONTENT_SIGNAL_PREAMBLE` in @dogsbay/site-files.
|
|
431
|
+
*/
|
|
432
|
+
contentSignalPreamble?: boolean;
|
|
433
|
+
/**
|
|
434
|
+
* Emit the non-standard `Llms-Txt:` line in robots.txt. Default
|
|
435
|
+
* `false` — see `AgentConfig.llmsTxtDirective` in `@dogsbay/cli`.
|
|
436
|
+
*/
|
|
437
|
+
llmsTxtDirective?: boolean;
|
|
438
|
+
/**
|
|
439
|
+
* "When to use this" guidance for llms.txt. See
|
|
440
|
+
* `AgentConfig.llmsWhenToUse` in `@dogsbay/cli`.
|
|
441
|
+
*/
|
|
442
|
+
llmsWhenToUse?: string;
|
|
163
443
|
/**
|
|
164
444
|
* Per-page LLM action UI ("Copy as markdown", "Open in Claude/
|
|
165
445
|
* ChatGPT/Perplexity/Gemini"). When omitted, the cluster is not
|
|
@@ -168,6 +448,46 @@ export interface AstroProjectOptions {
|
|
|
168
448
|
* See plans/llm-page-actions.md.
|
|
169
449
|
*/
|
|
170
450
|
llmActions?: import("@dogsbay/types").SiteConfig["llmActions"];
|
|
451
|
+
/**
|
|
452
|
+
* Resolved glyphs for the internal/external link-icon affordance.
|
|
453
|
+
* Baked into `site.json` as `linkIcons` and consumed by `DocsLayout`.
|
|
454
|
+
* Omitted when the feature is off. See plans/link-resolution-and-icons.md.
|
|
455
|
+
*/
|
|
456
|
+
linkIcons?: import("@dogsbay/types").SiteConfig["linkIcons"];
|
|
457
|
+
/**
|
|
458
|
+
* Patterns that mark slugs as fragments (no Astro route).
|
|
459
|
+
* Pages matching any pattern are written to neither
|
|
460
|
+
* `src/pages/*.astro` nor `src/pages/*.md.ts`. The `.md` source
|
|
461
|
+
* files remain on disk under `content/` so `{% include %}`
|
|
462
|
+
* directives in other pages can still resolve them; they just
|
|
463
|
+
* aren't reachable as URLs.
|
|
464
|
+
*
|
|
465
|
+
* Match semantics depend on whether the pattern contains `/`:
|
|
466
|
+
* - `"modules"` (single segment) matches ANY path segment of
|
|
467
|
+
* the slug equal to "modules" — `modules/foo`,
|
|
468
|
+
* `welcome/modules/foo`, `a/b/modules/c` all exclude.
|
|
469
|
+
* What AsciiBinder corpora want — fragment dirs symlink
|
|
470
|
+
* into section dirs so the same dir name appears at many
|
|
471
|
+
* depths.
|
|
472
|
+
* - `"foo/bar"` (multi-segment) matches as a leading prefix
|
|
473
|
+
* only — `foo/bar` and `foo/bar/baz` exclude, but
|
|
474
|
+
* `welcome/foo/bar` does not. For when a specific path
|
|
475
|
+
* tree is fragment territory.
|
|
476
|
+
*
|
|
477
|
+
* The companion signal — frontmatter `_fragment: true` — is also
|
|
478
|
+
* honoured (per-page opt-out, set by importers that know which
|
|
479
|
+
* `.md` files are include-only fragments vs navigable pages —
|
|
480
|
+
* `migrate-asciidoc` is the first such importer). Either signal
|
|
481
|
+
* is enough to skip; both stack.
|
|
482
|
+
*
|
|
483
|
+
* Typical use case: AsciiBinder-style corpora where shared
|
|
484
|
+
* fragments live under `modules/`, `_attributes/`, `snippets/`
|
|
485
|
+
* — the converter writes them as `.md` so includes resolve, but
|
|
486
|
+
* they have no business being navigable as standalone pages
|
|
487
|
+
* (and emitting 18k useless routes punishes the Astro compiler).
|
|
488
|
+
* See plans/build-at-scale.md.
|
|
489
|
+
*/
|
|
490
|
+
excludeFromRoutes?: string[];
|
|
171
491
|
}
|
|
172
492
|
/**
|
|
173
493
|
* Export pages + nav to a complete Astro project directory.
|
|
@@ -204,24 +524,95 @@ export declare function exportAstroProject(pages: ExportPage[], nav: NavItem[],
|
|
|
204
524
|
* through the full scaffold path. `emitSiteScaffold` also calls it.
|
|
205
525
|
*/
|
|
206
526
|
export declare function emitSiteConfig(outputDir: string, siteName: string, options: AstroProjectOptions): void;
|
|
527
|
+
/**
|
|
528
|
+
* Re-pin an existing site's `@dogsbay/*` dependencies to the building CLI's
|
|
529
|
+
* version. Safe to call on every build.
|
|
530
|
+
*
|
|
531
|
+
* `package.json` is scaffold-once, and for a long time this ran only from
|
|
532
|
+
* `emitSiteScaffold`, which `site build` never calls — so the guard against
|
|
533
|
+
* version drift was unreachable from the one command where drift happens.
|
|
534
|
+
* Measured on openshift-docs-markdown: a site rebuilt weekly for months kept
|
|
535
|
+
* installing the `@dogsbay/docs-layout` written at its first scaffold, so no
|
|
536
|
+
* change to a runtime component ever reached it. Its sibling escaped only
|
|
537
|
+
* because that workflow passes `--force`, which re-scaffolds.
|
|
538
|
+
*
|
|
539
|
+
* Returns the changes made, so the caller can report them: a build that
|
|
540
|
+
* silently edits a tracked file is worse than the drift it fixes.
|
|
541
|
+
*/
|
|
542
|
+
export declare function syncSiteDependencies(outputDir: string, options?: {
|
|
543
|
+
local?: boolean;
|
|
544
|
+
}): string[];
|
|
207
545
|
export declare function emitSiteScaffold(outputDir: string, siteName: string, options: AstroProjectOptions, writeScaffold: boolean): number;
|
|
208
546
|
/**
|
|
209
|
-
*
|
|
210
|
-
* .
|
|
211
|
-
*
|
|
212
|
-
*
|
|
547
|
+
* Nav entries come from a project's own TOC files (toctrees, `_toc.yml`,
|
|
548
|
+
* `myst.yml`, nav.yml), i.e. from content. An href with a scheme other than
|
|
549
|
+
* http(s)/mailto/tel — `javascript:` above all — is dropped (the entry keeps
|
|
550
|
+
* its label and children), so it cannot reach the sidebar, nav.json or a
|
|
551
|
+
* page's previous/next link.
|
|
213
552
|
*/
|
|
553
|
+
export declare function dropUnsafeNavHrefs(items: NavItem[]): NavItem[];
|
|
214
554
|
export declare function emitAstroPages(pages: ExportPage[], nav: NavItem[], outputDir: string, options: AstroProjectOptions): Promise<{
|
|
215
555
|
generated: number;
|
|
216
556
|
outputNav: NavItem[];
|
|
557
|
+
/**
|
|
558
|
+
* Output paths (relative to outputDir, OS-native separators) of the
|
|
559
|
+
* `.astro` files just written. Used by passthrough emit to detect
|
|
560
|
+
* collisions with hand-authored `.astro` files declared in nav.yml
|
|
561
|
+
* — see plans/passthrough-astro-pages.md.
|
|
562
|
+
*/
|
|
563
|
+
generatedPaths: Set<string>;
|
|
217
564
|
}>;
|
|
565
|
+
/** Passthrough source → destination pair, computed by the CLI's collector. */
|
|
566
|
+
export interface PassthroughCopy {
|
|
567
|
+
/** Absolute path to the source file (under contentDir). */
|
|
568
|
+
sourceAbs: string;
|
|
569
|
+
/**
|
|
570
|
+
* Output path relative to outputDir, OS-native separators. Same
|
|
571
|
+
* shape as `emitAstroPages` `generatedPaths` so the collision
|
|
572
|
+
* check can use a plain `Set.has`.
|
|
573
|
+
*/
|
|
574
|
+
outputRelPath: string;
|
|
575
|
+
/** Source path relative to contentDir, for error messages. */
|
|
576
|
+
source: string;
|
|
577
|
+
}
|
|
578
|
+
/**
|
|
579
|
+
* Copy each passthrough `.astro` source to its computed output path.
|
|
580
|
+
* Aborts with a clear error if the destination is already in
|
|
581
|
+
* `generatedPaths` (a generated page from `emitAstroPages` would
|
|
582
|
+
* silently overwrite the hand-authored file otherwise).
|
|
583
|
+
*/
|
|
584
|
+
export declare function emitPassthroughAstroPages(copies: PassthroughCopy[], outputDir: string, generatedPaths: Set<string>): {
|
|
585
|
+
copied: number;
|
|
586
|
+
};
|
|
218
587
|
/**
|
|
219
588
|
* Emit `public/robots.txt` with `Content-Signal` directives + sitemap
|
|
220
589
|
* link. Always overwrites — the file's contents are pure derivation
|
|
221
590
|
* from `options`. Maintainers wanting custom Disallow rules layer
|
|
222
591
|
* them at the CDN level.
|
|
223
592
|
*/
|
|
224
|
-
export declare function emitConfigDerivedFiles(outputDir: string, options: AstroProjectOptions): void;
|
|
593
|
+
export declare function emitConfigDerivedFiles(outputDir: string, options: AstroProjectOptions, pages?: ExportPage[]): void;
|
|
594
|
+
/**
|
|
595
|
+
* Per-deploy-target artifact emission.
|
|
596
|
+
*
|
|
597
|
+
* Called from `emitSiteScaffold` (with `forceOverwrite=writeScaffold`
|
|
598
|
+
* so `--force` regenerates from template) and from `dogsbay site
|
|
599
|
+
* build` (with `forceOverwrite=false` so an existing site can adopt
|
|
600
|
+
* a deploy target by editing config and rebuilding — the missing
|
|
601
|
+
* artifact gets created on the next build).
|
|
602
|
+
*
|
|
603
|
+
* Emit policy is the union: write when forced OR when the file is
|
|
604
|
+
* missing. Author edits to e.g. the workflow YAML survive every
|
|
605
|
+
* regular build.
|
|
606
|
+
*
|
|
607
|
+
* Currently handles `github-pages` (workflow + .nojekyll). The
|
|
608
|
+
* existing `cloudflare-workers` artifacts (wrangler.jsonc + package
|
|
609
|
+
* scripts) stay in the scaffold-only path because they overlap with
|
|
610
|
+
* scaffold-only files (package.json scripts, devDependencies). A
|
|
611
|
+
* future refactor could fold them in here too.
|
|
612
|
+
*/
|
|
613
|
+
export declare function emitDeployArtifacts(outputDir: string, options: AstroProjectOptions, opts?: {
|
|
614
|
+
forceOverwrite: boolean;
|
|
615
|
+
}): void;
|
|
225
616
|
/**
|
|
226
617
|
* Shape of the emitted `src/data/switcherMap.json` file.
|
|
227
618
|
* Switcher components import this JSON directly, so the shape
|
|
@@ -251,7 +642,13 @@ export interface SwitcherMap {
|
|
|
251
642
|
id: string;
|
|
252
643
|
label?: string;
|
|
253
644
|
eol?: boolean;
|
|
645
|
+
prerelease?: boolean;
|
|
646
|
+
hidden?: boolean;
|
|
254
647
|
default?: boolean;
|
|
648
|
+
/** Served at the site root (`path: ""`): its pages have no version segment. */
|
|
649
|
+
root?: boolean;
|
|
650
|
+
/** "Version: <label>" above each page's title. */
|
|
651
|
+
badge?: boolean;
|
|
255
652
|
}>;
|
|
256
653
|
/**
|
|
257
654
|
* Declared locales in declaration order. Same role as
|
|
@@ -269,7 +666,67 @@ export interface SwitcherMap {
|
|
|
269
666
|
* the full URL plus the (locale, version) combo it represents.
|
|
270
667
|
*/
|
|
271
668
|
byLogicalKey: Record<string, SwitcherVariant[]>;
|
|
669
|
+
/**
|
|
670
|
+
* With a `products:` block: each product's version rows per locale, keyed
|
|
671
|
+
* `<product|_>/<locale|_>`, in config order, hidden versions left out, each
|
|
672
|
+
* with its home URL (where the row goes when the page is not in it). The
|
|
673
|
+
* version switcher uses these instead of `versions`.
|
|
674
|
+
*/
|
|
675
|
+
productVersions?: Record<string, Array<{
|
|
676
|
+
id: string;
|
|
677
|
+
label?: string;
|
|
678
|
+
eol?: boolean;
|
|
679
|
+
prerelease?: boolean;
|
|
680
|
+
default?: boolean;
|
|
681
|
+
badge?: boolean;
|
|
682
|
+
home: string;
|
|
683
|
+
}>>;
|
|
684
|
+
/**
|
|
685
|
+
* The version menu's links (hrefs as served, base path included) and limit,
|
|
686
|
+
* keyed by product name, `_` for the site-wide versions and the unnamed
|
|
687
|
+
* source. Left out when no menu has any.
|
|
688
|
+
*/
|
|
689
|
+
versionMenu?: Record<string, {
|
|
690
|
+
links: Array<{
|
|
691
|
+
label: string;
|
|
692
|
+
href: string;
|
|
693
|
+
}>;
|
|
694
|
+
limit?: number;
|
|
695
|
+
}>;
|
|
696
|
+
/**
|
|
697
|
+
* With a `products:` block and two or more products: the product menu per
|
|
698
|
+
* locale (`<locale|_>`), in the block's order, each entry going to the
|
|
699
|
+
* product's home (its default version, in the locale when it has one) —
|
|
700
|
+
* site-files `productSwitcher`, as dogsbay-ssg's product menu.
|
|
701
|
+
*/
|
|
702
|
+
products?: Record<string, Array<{
|
|
703
|
+
name: string;
|
|
704
|
+
label: string;
|
|
705
|
+
home: string;
|
|
706
|
+
}>>;
|
|
707
|
+
/**
|
|
708
|
+
* The version banner each unit's pages carry, keyed by site-files `unitKeyString` (product,
|
|
709
|
+
* locale, version; just the version for site-wide versions): the version's own text, or a kind
|
|
710
|
+
* the layout words (older, no longer maintained, not released), and the default version it points
|
|
711
|
+
* to with its home URL (where the link goes when the page is not in that version). As dogsbay-ssg:
|
|
712
|
+
* with a `products:` block from site-files `unitOf`; site-wide, an older version only. Left out
|
|
713
|
+
* when no page has one.
|
|
714
|
+
*/
|
|
715
|
+
banners?: Record<string, VersionBannerData>;
|
|
272
716
|
}
|
|
717
|
+
/** A unit's version banner in switcherMap.json (site-files `UnitBanner`, `latest.home` as served). */
|
|
718
|
+
export type VersionBannerData = ({
|
|
719
|
+
kind: "custom";
|
|
720
|
+
text: string;
|
|
721
|
+
} | {
|
|
722
|
+
kind: "eol" | "prerelease" | "old";
|
|
723
|
+
}) & {
|
|
724
|
+
latest?: {
|
|
725
|
+
id: string;
|
|
726
|
+
label: string;
|
|
727
|
+
home: string;
|
|
728
|
+
};
|
|
729
|
+
};
|
|
273
730
|
export interface SwitcherVariant {
|
|
274
731
|
/** Present when the locale axis is active for this site. */
|
|
275
732
|
locale?: string;
|
|
@@ -317,4 +774,36 @@ export declare function emitMissingTranslationStubs(pages: ExportPage[], outputD
|
|
|
317
774
|
* `emitAstroPages` (they share the page-loop's serialization step).
|
|
318
775
|
*/
|
|
319
776
|
export declare function emitAgentReadinessFiles(pages: ExportPage[], outputNav: NavItem[], outputDir: string, siteName: string, options: AstroProjectOptions): void;
|
|
320
|
-
|
|
777
|
+
/**
|
|
778
|
+
* Build the contents of `public/_headers` (Cloudflare Pages / Workers
|
|
779
|
+
* Static Assets convention). Emits a global RFC 8288 Link header
|
|
780
|
+
* pointing at this mount's llms.txt index, so agents don't need to
|
|
781
|
+
* parse HTML to discover the LLM-friendly content listing.
|
|
782
|
+
*
|
|
783
|
+
* The Link target is basePath-prefixed (`</docs/llms.txt>` for a
|
|
784
|
+
* `/docs` mount) — matches where the platform actually emits
|
|
785
|
+
* llms.txt under the per-mount layout.
|
|
786
|
+
*/
|
|
787
|
+
/**
|
|
788
|
+
* URL for `<link rel="icon">`, or `false` when the project ships no
|
|
789
|
+
* favicon.
|
|
790
|
+
*
|
|
791
|
+
* The scaffold deliberately ships none — authors drop their own into
|
|
792
|
+
* `public/`. Emitting the link unconditionally therefore advertised a
|
|
793
|
+
* 404 on every generated site. Checks `.ico` then `.svg`, matching the
|
|
794
|
+
* two the scaffold documents.
|
|
795
|
+
*/
|
|
796
|
+
export declare function faviconHref(outputDir: string, urlBase: string): string | false;
|
|
797
|
+
/**
|
|
798
|
+
* The version served at the site root: the `defaultVersion` when its
|
|
799
|
+
* `versions` entry has `path: ""` (the CLI's config load allows it on no
|
|
800
|
+
* other version). Its pages have no version segment.
|
|
801
|
+
*/
|
|
802
|
+
export declare function rootVersionOf(options: Pick<AstroProjectOptions, "versions" | "defaultVersion">): string | undefined;
|
|
803
|
+
/**
|
|
804
|
+
* Copy the UI component folders the serializer can emit into the site's
|
|
805
|
+
* `src/components/ui/`, skipping any that exist (project-owned, maybe
|
|
806
|
+
* edited). Returns the names added. `site build` calls it so a component
|
|
807
|
+
* introduced in a release (Kbd, FileTree) reaches sites scaffolded earlier.
|
|
808
|
+
*/
|
|
809
|
+
export declare function copyComponents(outputDir: string): string[];
|