@dogsbay/format-astro 0.2.0-beta.12 → 0.2.0-beta.121

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 (83) hide show
  1. package/dist/api-markdown.d.ts +8 -0
  2. package/dist/api-markdown.d.ts.map +1 -0
  3. package/dist/api-markdown.js +50 -0
  4. package/dist/api-markdown.js.map +1 -0
  5. package/dist/base-path.d.ts +93 -7
  6. package/dist/base-path.d.ts.map +1 -1
  7. package/dist/base-path.js +122 -8
  8. package/dist/base-path.js.map +1 -1
  9. package/dist/blog.d.ts +134 -0
  10. package/dist/blog.d.ts.map +1 -0
  11. package/dist/blog.js +324 -0
  12. package/dist/blog.js.map +1 -0
  13. package/dist/browser.d.ts +14 -0
  14. package/dist/browser.d.ts.map +1 -0
  15. package/dist/browser.js +14 -0
  16. package/dist/browser.js.map +1 -0
  17. package/dist/canonical.d.ts +34 -0
  18. package/dist/canonical.d.ts.map +1 -0
  19. package/dist/canonical.js +107 -0
  20. package/dist/canonical.js.map +1 -0
  21. package/dist/cli.d.ts.map +1 -1
  22. package/dist/cli.js +1 -0
  23. package/dist/cli.js.map +1 -1
  24. package/dist/diff-decoration.d.ts +79 -0
  25. package/dist/diff-decoration.d.ts.map +1 -0
  26. package/dist/diff-decoration.js +541 -0
  27. package/dist/diff-decoration.js.map +1 -0
  28. package/dist/granularity.d.ts +83 -0
  29. package/dist/granularity.d.ts.map +1 -0
  30. package/dist/granularity.js +247 -0
  31. package/dist/granularity.js.map +1 -0
  32. package/dist/head-metadata.d.ts +26 -0
  33. package/dist/head-metadata.d.ts.map +1 -0
  34. package/dist/head-metadata.js +56 -0
  35. package/dist/head-metadata.js.map +1 -0
  36. package/dist/index.d.ts +24 -4
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/index.js +30 -3
  39. package/dist/index.js.map +1 -1
  40. package/dist/lead.d.ts +1 -38
  41. package/dist/lead.d.ts.map +1 -1
  42. package/dist/lead.js +3 -37
  43. package/dist/lead.js.map +1 -1
  44. package/dist/llms-txt.d.ts +53 -11
  45. package/dist/llms-txt.d.ts.map +1 -1
  46. package/dist/llms-txt.js +85 -222
  47. package/dist/llms-txt.js.map +1 -1
  48. package/dist/plugins.d.ts.map +1 -1
  49. package/dist/plugins.js +4 -2
  50. package/dist/plugins.js.map +1 -1
  51. package/dist/project.d.ts +377 -12
  52. package/dist/project.d.ts.map +1 -1
  53. package/dist/project.js +2263 -661
  54. package/dist/project.js.map +1 -1
  55. package/dist/redirects.d.ts +116 -0
  56. package/dist/redirects.d.ts.map +1 -0
  57. package/dist/redirects.js +224 -0
  58. package/dist/redirects.js.map +1 -0
  59. package/dist/serialize.d.ts +14 -0
  60. package/dist/serialize.d.ts.map +1 -1
  61. package/dist/serialize.js +643 -216
  62. package/dist/serialize.js.map +1 -1
  63. package/dist/sitemap.d.ts +108 -0
  64. package/dist/sitemap.d.ts.map +1 -0
  65. package/dist/sitemap.js +127 -0
  66. package/dist/sitemap.js.map +1 -0
  67. package/dist/taxonomy.d.ts +48 -1
  68. package/dist/taxonomy.d.ts.map +1 -1
  69. package/dist/taxonomy.js +46 -11
  70. package/dist/taxonomy.js.map +1 -1
  71. package/dist/theme-css.d.ts +26 -0
  72. package/dist/theme-css.d.ts.map +1 -0
  73. package/dist/theme-css.js +651 -0
  74. package/dist/theme-css.js.map +1 -0
  75. package/dist/tone-classes.d.ts +14 -0
  76. package/dist/tone-classes.d.ts.map +1 -0
  77. package/dist/tone-classes.js +30 -0
  78. package/dist/tone-classes.js.map +1 -0
  79. package/dist/write-if-changed.d.ts +21 -0
  80. package/dist/write-if-changed.d.ts.map +1 -0
  81. package/dist/write-if-changed.js +58 -0
  82. package/dist/write-if-changed.js.map +1 -0
  83. package/package.json +16 -7
package/dist/blog.js ADDED
@@ -0,0 +1,324 @@
1
+ /**
2
+ * Blog emission for `dogsbay site build`.
3
+ *
4
+ * Dogsbay has no blog primitive; this adds one. See
5
+ * plans/blog-capability.md.
6
+ *
7
+ * The shape deliberately mirrors `taxonomy.ts`, which already solves
8
+ * the same problem — turn a page set into a generated list page:
9
+ *
10
+ * - `src/data/blog.json` — the post list, newest first
11
+ * - `src/pages<indexPath>/…` — the reverse-chron index route(s)
12
+ *
13
+ * A blog index is that emitter sorted by DATE rather than grouped by
14
+ * term. Route files carry the auto-generated marker and are left alone
15
+ * once a writer edits them, exactly as taxonomy routes are.
16
+ *
17
+ * Two things here are not obvious and are load-bearing:
18
+ *
19
+ * - **Adjacency is chronological, not navigational.** `getPagination`
20
+ * in `@dogsbay/docs-layout` walks `NavItem[]`, i.e. sidebar order. A
21
+ * blog has no sidebar and its prev/next is "the post before this
22
+ * one in time". Post pages get their links from {@link blogAdjacency}
23
+ * instead.
24
+ * - **Reading time is computed HERE, at emit time.** The word count
25
+ * never changes after the build, so doing it in the browser would
26
+ * re-walk the DOM on every page load for a constant.
27
+ */
28
+ import { existsSync, mkdirSync, readFileSync, rmSync } from "node:fs";
29
+ // Unchanged files are not rewritten, so `site dev` reloads only what changed
30
+ import { writeFileSync } from "./write-if-changed.js";
31
+ import { dirname, join } from "node:path";
32
+ import { basePathSegments, joinBaseUrl, withBasePath } from "./base-path.js";
33
+ import { derivePageDescription, textOfNode } from "./taxonomy.js";
34
+ /** Words per minute used for reading-time estimates. */
35
+ const WORDS_PER_MINUTE = 200;
36
+ /** Marker that makes an emitted route file safe to regenerate. */
37
+ const AUTO_GENERATED_MARKER = "// AUTO-GENERATED by dogsbay";
38
+ /**
39
+ * The marker `emitAstroPages` puts on its generated ROUTE STUBS (the root
40
+ * redirect). Matched exactly, because content pages carry a different
41
+ * banner — `AUTO-GENERATED by \`dogsbay convert\`` — and treating that as
42
+ * regenerable meant a real `content/index.md` was silently overwritten by
43
+ * the blog index AND excluded from the post list. The page just vanished.
44
+ */
45
+ const STUB_MARKER = "// AUTO-GENERATED by dogsbay site build";
46
+ /** Defaults for a `blog:` block that omits fields. */
47
+ export const BLOG_DEFAULTS = {
48
+ indexPath: "/",
49
+ postsPerPage: 20,
50
+ rss: true,
51
+ dateField: "created",
52
+ };
53
+ /**
54
+ * Count words in a page's body.
55
+ *
56
+ * Deliberately crude: whitespace-split on the extracted plain text.
57
+ * Reading time is a reading CUE, not a measurement, and a more precise
58
+ * count would not change the rendered minutes.
59
+ */
60
+ export function countWords(page) {
61
+ const text = (page.tree ?? [])
62
+ .map((node) => textOfNode(node))
63
+ .join(" ")
64
+ .replace(/\s+/g, " ")
65
+ .trim();
66
+ if (text.length === 0)
67
+ return 0;
68
+ return text.split(" ").length;
69
+ }
70
+ /** Whole minutes at {@link WORDS_PER_MINUTE}, never less than 1. */
71
+ export function readingMinutes(page) {
72
+ const words = countWords(page);
73
+ if (words === 0)
74
+ return 1;
75
+ return Math.max(1, Math.round(words / WORDS_PER_MINUTE));
76
+ }
77
+ function firstString(value) {
78
+ return typeof value === "string" && value.length > 0 ? value : undefined;
79
+ }
80
+ /**
81
+ * Build the post list from the page set.
82
+ *
83
+ * EVERY page is a post except the one that would occupy the index
84
+ * route itself. A site that declares `blog:` IS a blog; there is no
85
+ * second "is this a post?" axis to configure, and inventing one would
86
+ * mean a post silently vanishing because a field was missing.
87
+ *
88
+ * Undated posts sort last, in title order, rather than being dropped —
89
+ * a post with no date is an authoring mistake worth SEEING, not
90
+ * hiding.
91
+ */
92
+ export function buildBlogData(pages, opts) {
93
+ const { basePath, section, config } = opts;
94
+ // URLs use the COMBINED prefix (urlBase + basePath) — the path the host
95
+ // actually serves under. Falling back to basePath keeps callers that
96
+ // only have the one value working, but a mounted site MUST pass
97
+ // urlPrefix or every post link drops the mount and lands on whatever
98
+ // owns the host root.
99
+ const urlPrefix = opts.urlPrefix ?? basePath;
100
+ const posts = [];
101
+ for (const page of pages) {
102
+ // The index route is generated from the post list; a page at that
103
+ // slug would be listing itself.
104
+ if (page.slug === "index" && config.indexPath === "/")
105
+ continue;
106
+ // Only pages that BECOME routes can be posts. emitAstroPages skips
107
+ // fragments and excludeFromRoutes matches, so listing them produced
108
+ // index cards and Newer/Older links to pages that never existed.
109
+ const fm = (page.frontmatter ?? {});
110
+ if (page.fragment === true || fm._fragment === true)
111
+ continue;
112
+ if (opts.excludeSlug?.(page.slug))
113
+ continue;
114
+ const meta = page.meta ?? {};
115
+ const date = meta[config.dateField];
116
+ const updated = meta.updated;
117
+ posts.push({
118
+ slug: page.slug,
119
+ title: page.title ?? page.slug,
120
+ // section threaded like taxonomy.ts's pageUrl — without it, a
121
+ // sectioned build linked /slug/ while the page lives at
122
+ // /section/slug/, so every blog link 404'd.
123
+ url: joinBaseUrl(urlPrefix, section, page.slug),
124
+ description: derivePageDescription(page),
125
+ ...(typeof date === "string" ? { date } : {}),
126
+ ...(typeof updated === "string" && updated !== date ? { updated } : {}),
127
+ ...(meta.author ? { author: meta.author } : {}),
128
+ ...(meta.tags ? { tags: meta.tags } : {}),
129
+ ...(firstString(fm.heroImage) ? { heroImage: firstString(fm.heroImage) } : {}),
130
+ readingMinutes: readingMinutes(page),
131
+ });
132
+ }
133
+ posts.sort((a, b) => {
134
+ if (a.date && b.date)
135
+ return a.date < b.date ? 1 : a.date > b.date ? -1 : 0;
136
+ if (a.date)
137
+ return -1;
138
+ if (b.date)
139
+ return 1;
140
+ return a.title.localeCompare(b.title);
141
+ });
142
+ return {
143
+ indexPath: config.indexPath === "/"
144
+ ? urlPrefix || "/"
145
+ : withBasePath(urlPrefix, config.indexPath),
146
+ basePath,
147
+ ...(section ? { section } : {}),
148
+ urlPrefix,
149
+ postsPerPage: config.postsPerPage,
150
+ posts,
151
+ postCount: posts.length,
152
+ };
153
+ }
154
+ /**
155
+ * Prev/next per post slug, in TIME order — `prev` older, `next` newer.
156
+ *
157
+ * The footer renders prev on the left and next on the right, so this is
158
+ * the direction a timeline runs: older behind you, newer ahead. It also
159
+ * matches how a series is read. `data.posts` is newest-first for the
160
+ * index listing, so the neighbours are deliberately taken the other way
161
+ * round from the array order.
162
+ *
163
+ * The first version had `prev` as the NEWER neighbour, reasoning that a
164
+ * blog archive is browsed backwards. That made the right-hand link walk
165
+ * a reader BACKWARDS through a series — part 1's "next" was nothing, and
166
+ * its left-hand link was part 2.
167
+ */
168
+ export function blogAdjacency(data) {
169
+ const out = new Map();
170
+ data.posts.forEach((post, i) => {
171
+ // posts[] is newest-first, so the OLDER neighbour is the next index.
172
+ const prev = data.posts[i + 1];
173
+ const next = data.posts[i - 1];
174
+ out.set(post.slug, {
175
+ ...(prev ? { prev: { title: prev.title, href: prev.url } } : {}),
176
+ ...(next ? { next: { title: next.title, href: next.url } } : {}),
177
+ });
178
+ });
179
+ return out;
180
+ }
181
+ /**
182
+ * Regenerate an emitted route unless a writer has taken it over.
183
+ *
184
+ * Same contract as `taxonomy.ts`: the marker means "ours, safe to
185
+ * overwrite"; its absence means someone edited the file and their work
186
+ * wins. A content-derived page also counts as ours — it carries a
187
+ * `dogsbay convert` banner — so a scaffold's placeholder index does not
188
+ * block the blog index from claiming the route.
189
+ */
190
+ function shouldRegenerate(path) {
191
+ if (!existsSync(path))
192
+ return true;
193
+ const contents = readFileSync(path, "utf-8");
194
+ // Ours (a previous blog index) or a generated route stub — replaceable.
195
+ // Anything else, INCLUDING a content page, belongs to the author.
196
+ return contents.includes(AUTO_GENERATED_MARKER) || contents.includes(STUB_MARKER);
197
+ }
198
+ /** Number of index pages at the configured page size. */
199
+ export function indexPageCount(data) {
200
+ return Math.max(1, Math.ceil(data.posts.length / data.postsPerPage));
201
+ }
202
+ /**
203
+ * Emit `src/data/blog.json` plus the index route(s).
204
+ *
205
+ * Page 1 lives at the index path; subsequent pages at
206
+ * `<indexPath>/page/<n>`. Data JSON is overwritten unconditionally —
207
+ * it is pure derived data — while route files respect the marker.
208
+ */
209
+ export function emitBlogFiles(outputDir, data, config) {
210
+ mkdirSync(join(outputDir, "src", "data"), { recursive: true });
211
+ writeFileSync(join(outputDir, "src", "data", "blog.json"), JSON.stringify(data, null, 2));
212
+ const routes = [];
213
+ const skipped = [];
214
+ // Routes live where the PAGES live: <basePath>/<section>/… . Missing
215
+ // the section put the index at the site root while every post sat one
216
+ // level down.
217
+ const segments = [
218
+ ...basePathSegments(data.basePath),
219
+ ...(data.section ? basePathSegments(`/${data.section}`) : []),
220
+ ];
221
+ const indexSegments = config.indexPath === "/" ? [] : basePathSegments(config.indexPath);
222
+ const total = indexPageCount(data);
223
+ for (let pageNo = 1; pageNo <= total; pageNo++) {
224
+ const parts = pageNo === 1
225
+ ? [...segments, ...indexSegments, "index.astro"]
226
+ : [...segments, ...indexSegments, "page", `${pageNo}.astro`];
227
+ const routePath = join(outputDir, "src", "pages", ...parts);
228
+ if (!shouldRegenerate(routePath)) {
229
+ skipped.push(routePath);
230
+ continue;
231
+ }
232
+ mkdirSync(dirname(routePath), { recursive: true });
233
+ writeFileSync(routePath, buildIndexRoute(pageNo, total));
234
+ routes.push(routePath);
235
+ }
236
+ // Prune pagination routes the current post count no longer needs.
237
+ // Without this, deleting posts (or raising postsPerPage) left the
238
+ // previous build's page/3.astro in place: it still compiles, slices
239
+ // past the end of the list, and serves a live "No posts yet. Page 3
240
+ // of 2".
241
+ const pruned = [];
242
+ for (let stale = total + 1;; stale++) {
243
+ const stalePath = join(outputDir, "src", "pages", ...segments, ...indexSegments, "page", `${stale}.astro`);
244
+ if (!existsSync(stalePath))
245
+ break;
246
+ if (!shouldRegenerate(stalePath))
247
+ break; // writer took it over
248
+ rmSync(stalePath, { force: true });
249
+ pruned.push(stalePath);
250
+ }
251
+ return { routes, skipped, pruned };
252
+ }
253
+ /**
254
+ * One index route file.
255
+ *
256
+ * Reads the emitted JSON at build time (not runtime) and hands a slice
257
+ * to `<BlogIndex>`. Kept deliberately thin: all layout lives in the
258
+ * component, so a template fix propagates on rebuild rather than being
259
+ * baked into every generated route.
260
+ */
261
+ function buildIndexRoute(pageNo, totalPages) {
262
+ // wideLayout: blog chrome centres prose at max-w-3xl, which is right for
263
+ // a post and far too narrow for a three-across card grid. The index is
264
+ // the one blog route that wants the full measure.
265
+ //
266
+ // `@/` alias throughout, not relative paths — page 1 and page N sit at
267
+ // different depths under src/pages, and a hardcoded `../../` is correct
268
+ // for exactly one of them. Matches the taxonomy route template.
269
+ return `---
270
+ ${AUTO_GENERATED_MARKER} site build — safe to delete; will regenerate next build.
271
+ // To customize this page, remove the marker line above (or modify the file
272
+ // in any way that drops it) and dogsbay will leave your edits alone.
273
+ import "@/styles/global.css";
274
+ import DocsLayout from "@dogsbay/docs-layout/DocsLayout.astro";
275
+ import BlogIndex from "@dogsbay/docs-layout/BlogIndex.astro";
276
+ import type { SiteConfig } from "@dogsbay/types";
277
+ import blog from "@/data/blog.json";
278
+ import navData from "@/data/nav.json";
279
+ import siteConfigData from "@/data/site.json";
280
+ const siteConfig = siteConfigData as SiteConfig;
281
+ // Read untyped: favicon is site.json data, not part of the published
282
+ // SiteConfig type, so this needs no @dogsbay/types release.
283
+ const favicon = (siteConfigData as { favicon?: string }).favicon;
284
+ const pageNo = ${pageNo};
285
+ const totalPages = ${totalPages};
286
+ const start = (pageNo - 1) * blog.postsPerPage;
287
+ const posts = blog.posts.slice(start, start + blog.postsPerPage);
288
+ const title = pageNo === 1 ? siteConfig.siteName : \`\${siteConfig.siteName} — page \${pageNo}\`;
289
+ ---
290
+ <DocsLayout
291
+ siteName={siteConfig.siteName}
292
+ siteTagline={siteConfig.tagline}
293
+ title={title}
294
+ nav={navData as any[]}
295
+ headings={[]}
296
+ siteUrl={siteConfig.siteUrl || "/"}
297
+ description={siteConfig.description || undefined}
298
+ ogImage={siteConfig.ogImage || undefined}
299
+ twitterHandle={siteConfig.twitterHandle || undefined}
300
+ themeColor={siteConfig.themeColor || undefined}
301
+ repoUrl={siteConfig.repoUrl || undefined}
302
+ poweredBy={siteConfig.poweredBy !== false}
303
+ plausibleDomain={siteConfig.plausible?.domain}
304
+ plausibleScriptUrl={siteConfig.plausible?.scriptUrl}
305
+ tagPrefixes={siteConfig.tagPrefixes}
306
+ tagLabels={siteConfig.tagLabels}
307
+ tagAutoColor={siteConfig.tagAutoColor}
308
+ taxonomyIndexPaths={siteConfig.taxonomyIndexPaths}
309
+ chrome="blog"
310
+ favicon={favicon}
311
+ basePath={blog.urlPrefix}
312
+ autoH1={false}
313
+ wideLayout={true}
314
+ >
315
+ <BlogIndex
316
+ posts={posts}
317
+ indexPath={blog.indexPath}
318
+ pageNo={pageNo}
319
+ totalPages={totalPages}
320
+ />
321
+ </DocsLayout>
322
+ `;
323
+ }
324
+ //# sourceMappingURL=blog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blog.js","sourceRoot":"","sources":["../src/blog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACtE,6EAA6E;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAElE,wDAAwD;AACxD,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAE7B,kEAAkE;AAClE,MAAM,qBAAqB,GAAG,8BAA8B,CAAC;AAE7D;;;;;;GAMG;AACH,MAAM,WAAW,GAAG,yCAAyC,CAAC;AAkB9D,sDAAsD;AACtD,MAAM,CAAC,MAAM,aAAa,GAAmB;IAC3C,SAAS,EAAE,GAAG;IACd,YAAY,EAAE,EAAE;IAChB,GAAG,EAAE,IAAI;IACT,SAAS,EAAE,SAAS;CACrB,CAAC;AAsDF;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,IAAgB;IACzC,MAAM,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;SAC3B,GAAG,CAAC,CAAC,IAAI,EAAE,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yE;IACzE,uEAAuE;IACvE,kDAAkD;IAClD,EAAE;IACF,uEAAuE;IACvE,wEAAwE;IACxE,gEAAgE;IAChE,OAAO;EACP,qBAAqB;;;;;;;;;;;;;;iBAcN,MAAM;qBACF,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqC9B,CAAC;AACF,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The Worker- and browser-safe part of @dogsbay/format-astro: the builders
3
+ * and helpers that import no Node built-ins. The main entry also writes files
4
+ * (project generation, plugins, taxonomy pages) and needs Node.
5
+ *
6
+ * Used by packages that run in a Worker or a browser as well as in Node,
7
+ * such as @dogsbay/site-check and dogsbay-ssg.
8
+ */
9
+ export * from "./lead.js";
10
+ export * from "./llms-txt.js";
11
+ export * from "./sitemap.js";
12
+ export * from "./redirects.js";
13
+ export * from "./base-path.js";
14
+ //# sourceMappingURL=browser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The Worker- and browser-safe part of @dogsbay/format-astro: the builders
3
+ * and helpers that import no Node built-ins. The main entry also writes files
4
+ * (project generation, plugins, taxonomy pages) and needs Node.
5
+ *
6
+ * Used by packages that run in a Worker or a browser as well as in Node,
7
+ * such as @dogsbay/site-check and dogsbay-ssg.
8
+ */
9
+ export * from "./lead.js";
10
+ export * from "./llms-txt.js";
11
+ export * from "./sitemap.js";
12
+ export * from "./redirects.js";
13
+ export * from "./base-path.js";
14
+ //# sourceMappingURL=browser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Canonical URLs on a versioned site: a page of an older version names the
3
+ * same page in the default version, and leaves the sitemap. The decision is
4
+ * `decideCanonical` in @dogsbay/site-files, shared with dogsbay-ssg (its
5
+ * src/core/canonical.ts); this file gives it the default version's pages
6
+ * and redirects from the imported pages. See dogsbay-ssg
7
+ * plans/canonical-versions.md, step 2.
8
+ */
9
+ import type { ExportPage } from "@dogsbay/types";
10
+ import { type VersionSeo } from "@dogsbay/site-files";
11
+ export interface CanonicalPlanOptions {
12
+ /** Pages the build does not emit (fragments, `excludeFromRoutes`): never a canonical target. */
13
+ isEmitted?: (page: ExportPage) => boolean;
14
+ siteUrl?: string;
15
+ /** urlBase + basePath, as the sitemap takes it. */
16
+ basePath?: string;
17
+ versions?: Array<{
18
+ id: string;
19
+ } & VersionSeo>;
20
+ defaultVersion?: string;
21
+ redirects?: Record<string, string | {
22
+ to: string;
23
+ status?: number;
24
+ }>;
25
+ }
26
+ export interface PageCanonical {
27
+ /** The canonical URL when it is not the page itself (DocsLayout computes that one). */
28
+ url?: string;
29
+ noindex: boolean;
30
+ sitemap: boolean;
31
+ }
32
+ /** Per page slug: its canonical, noindex and sitemap decision. */
33
+ export declare function canonicalPlan(pages: ExportPage[], o: CanonicalPlanOptions): Map<string, PageCanonical>;
34
+ //# sourceMappingURL=canonical.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canonical.d.ts","sourceRoot":"","sources":["../src/canonical.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAmB,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAIvE,MAAM,WAAW,oBAAoB;IACnC,gGAAgG;IAChG,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,OAAO,CAAC;IAC1C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mDAAmD;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,UAAU,CAAC,CAAC;IAC9C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACtE;AAED,MAAM,WAAW,aAAa;IAC5B,uFAAuF;IACvF,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;CAClB;AAID,kEAAkE;AAClE,wBAAgB,aAAa,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE,CAAC,EAAE,oBAAoB,GAAG,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CA4FtG"}
@@ -0,0 +1,107 @@
1
+ import { decideCanonical } from "@dogsbay/site-files";
2
+ import { normalizePrefix, originOf, pageHref } from "./sitemap.js";
3
+ import { inPageUnit, pageUnitPrefix } from "./redirects.js";
4
+ const URL_RE = /^[a-z][a-z0-9+.-]*:/i;
5
+ /** Per page slug: its canonical, noindex and sitemap decision. */
6
+ export function canonicalPlan(pages, o) {
7
+ const plan = new Map();
8
+ const prefix = normalizePrefix(o.basePath);
9
+ const origin = o.siteUrl && /^https?:\/\//.test(o.siteUrl) ? originOf(o.siteUrl).replace(/\/+$/, "") : undefined;
10
+ const basePath = prefix.replace(/^\//, "");
11
+ // Site paths as page slugs are written: no slashes at the ends, no base path, no suffix.
12
+ const norm = (s) => {
13
+ let p = s.trim().replace(/[?#].*$/, "").replace(/^\/+|\/+$/g, "");
14
+ if (basePath && (p === basePath || p.startsWith(basePath + "/")))
15
+ p = p.slice(basePath.length).replace(/^\//, "");
16
+ return p.replace(/(^|\/)index$/, "");
17
+ };
18
+ const live = (p) => !p.redirect && p.frontmatter?.draft !== true && p.frontmatter?.status !== "draft" && (o.isEmitted?.(p) ?? true);
19
+ const slugOf = (p) => norm(p.slug);
20
+ const pageSlugs = new Set(pages.filter(live).map(slugOf));
21
+ // Redirects by site path, chains collapsed; front matter paths are inside the page's unit (#096).
22
+ const raw = new Map();
23
+ for (const p of pages) {
24
+ // Front matter paths are relative to the page's language and version (#096), as collectRedirects reads them.
25
+ const unit = pageUnitPrefix(p);
26
+ if (typeof p.redirect === "string")
27
+ raw.set(slugOf(p), URL_RE.test(p.redirect) ? p.redirect : norm(inPageUnit(p.redirect, unit, prefix)));
28
+ const aliases = p.frontmatter?.aliases;
29
+ if (Array.isArray(aliases))
30
+ for (const a of aliases)
31
+ if (typeof a === "string" && !URL_RE.test(a))
32
+ raw.set(norm(inPageUnit(a, unit, prefix)), slugOf(p));
33
+ }
34
+ for (const [from, v] of Object.entries(o.redirects ?? {})) {
35
+ const to = typeof v === "string" ? v : v.to;
36
+ raw.set(norm(from), URL_RE.test(to) ? to : norm(to));
37
+ }
38
+ const resolve = (from) => {
39
+ let to = raw.get(from);
40
+ const seen = new Set([from]);
41
+ while (to !== undefined && !URL_RE.test(to) && !pageSlugs.has(to) && raw.has(to) && !seen.has(to)) {
42
+ seen.add(to);
43
+ to = raw.get(to);
44
+ }
45
+ if (to === undefined || seen.has(to))
46
+ return undefined;
47
+ return URL_RE.test(to) || pageSlugs.has(to) ? to : undefined;
48
+ };
49
+ // The default version's pages per language and namespace, by path inside the version.
50
+ const group = (p) => `${p.multiSource?.namespace ?? ""}\0${p.multiSource?.locale ?? ""}`;
51
+ const inVersion = (p) => {
52
+ const orig = (p.multiSource?.originalSlug ?? p.slug).replace(/^\/+|\/+$/g, "");
53
+ return orig === "" ? "index" : orig.replace(/\/index$/, "");
54
+ };
55
+ /** The page's site-path prefix: its slug without the path inside its version. */
56
+ const prefixOf = (p) => {
57
+ const s = slugOf(p);
58
+ const inV = inVersion(p);
59
+ if (inV === "index")
60
+ return s;
61
+ return s.endsWith("/" + inV) ? s.slice(0, -inV.length - 1) : s === inV ? "" : s;
62
+ };
63
+ const defaults = new Map();
64
+ if (o.defaultVersion) {
65
+ for (const p of pages) {
66
+ if (p.multiSource?.version !== o.defaultVersion || !live(p))
67
+ continue;
68
+ const g = defaults.get(group(p)) ?? { prefix: prefixOf(p), pages: new Map() };
69
+ g.pages.set(inVersion(p), slugOf(p));
70
+ defaults.set(group(p), g);
71
+ }
72
+ }
73
+ const hasOlder = pages.some((p) => p.multiSource?.version && p.multiSource.version !== o.defaultVersion);
74
+ const url = (slug) => (origin ? `${origin}${pageHref(slug, prefix)}` : undefined);
75
+ for (const p of pages) {
76
+ if (!live(p))
77
+ continue;
78
+ const version = o.versions?.find((v) => v.id === p.multiSource?.version);
79
+ const table = defaults.get(group(p));
80
+ const fm = typeof p.frontmatter?.canonicalUrl === "string" ? p.frontmatter.canonicalUrl : undefined;
81
+ const d = decideCanonical({
82
+ selfUrl: url(slugOf(p)),
83
+ isDefault: !hasOlder || !p.multiSource?.version || p.multiSource.version === o.defaultVersion || !table,
84
+ path: inVersion(p),
85
+ version,
86
+ frontmatter: fm,
87
+ defaultHas: (path) => !!table?.pages.has(path),
88
+ defaultRedirect: (path) => {
89
+ if (!table)
90
+ return undefined;
91
+ const r = resolve([table.prefix, path === "index" ? "" : path].filter(Boolean).join("/"));
92
+ if (r === undefined || URL_RE.test(r))
93
+ return r;
94
+ const inside = table.prefix ? (r === table.prefix ? "index" : r.startsWith(table.prefix + "/") ? r.slice(table.prefix.length + 1) : undefined) : r || "index";
95
+ return inside !== undefined && table.pages.has(inside) ? inside : `/${r}`;
96
+ },
97
+ });
98
+ const t = d.target;
99
+ plan.set(p.slug, {
100
+ url: t.kind === "self" ? undefined : t.kind === "url" ? t.url : url(table.pages.get(t.path)),
101
+ noindex: d.noindex,
102
+ sitemap: d.sitemap,
103
+ });
104
+ }
105
+ return plan;
106
+ }
107
+ //# sourceMappingURL=canonical.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canonical.js","sourceRoot":"","sources":["../src/canonical.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,eAAe,EAAmB,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAoB5D,MAAM,MAAM,GAAG,sBAAsB,CAAC;AAEtC,kEAAkE;AAClE,MAAM,UAAU,aAAa,CAAC,KAAmB,EAAE,CAAuB;IACxE,MAAM,IAAI,GAAG,IAAI,GAAG,EAAyB,CAAC;IAC9C,MAAM,MAAM,GAAG,eAAe,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;IAC3C,MAAM,MAAM,GAAG,CAAC,CAAC,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACjH,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC3C,yFAAyF;IACzF,MAAM,IAAI,GAAG,CAAC,CAAS,EAAU,EAAE;QACjC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;QAClE,IAAI,QAAQ,IAAI,CAAC,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,UAAU,CAAC,QAAQ,GAAG,GAAG,CAA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CpB,CAAC"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAuB,MAAM,gBAAgB,CAAC;AAGxE;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,MAAM,EAAE,YAwCpB,CAAC"}
package/dist/cli.js CHANGED
@@ -38,6 +38,7 @@ export const plugin = {
38
38
  theme: opts.theme,
39
39
  local: opts.local,
40
40
  sourceDir: opts.sourceDir,
41
+ assetMounts: opts.assetMounts,
41
42
  imageOptimization: opts.optimizeImages,
42
43
  codeBlockTitle,
43
44
  section: opts.section,
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,MAAM,GAAiB;IAClC,IAAI,EAAE,OAAO;IACb,SAAS,EAAE,KAAK;IAChB,SAAS,EAAE,IAAI;IACf,YAAY,EAAE,GAAG,EAAE,CAAC,KAAK;IACzB,aAAa,EAAE;QACb,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,mEAAmE,EAAE;QACtG,EAAE,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,4DAA4D,EAAE;QACjG,EAAE,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,yEAAyE,EAAE;KACpH;IAED,KAAK,CAAC,MAAM,CACV,KAAmB,EACnB,GAAc,EACd,MAAc,EACd,IAA6B;QAE7B,MAAM,UAAU,GAAG,IAAI,CAAC,UAAgC,CAAC;QACzD,MAAM,cAAc,GAClB,UAAU,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM;YAC9B,CAAC,CAAC,UAAU,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK;gBAChC,CAAC,CAAC,IAAI,CAAC;QA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