@eqtylab/docs 0.3.0

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 (94) hide show
  1. package/README.md +201 -0
  2. package/dist/chunk-55J6XMHW.js +3 -0
  3. package/dist/chunk-55J6XMHW.js.map +1 -0
  4. package/dist/chunk-ATIOPYKE.js +102 -0
  5. package/dist/chunk-ATIOPYKE.js.map +1 -0
  6. package/dist/chunk-GSSSQTEV.js +51 -0
  7. package/dist/chunk-GSSSQTEV.js.map +1 -0
  8. package/dist/chunk-IWKZQ4CW.js +68 -0
  9. package/dist/chunk-IWKZQ4CW.js.map +1 -0
  10. package/dist/chunk-K7PJRTK3.js +113 -0
  11. package/dist/chunk-K7PJRTK3.js.map +1 -0
  12. package/dist/chunk-VJN3HXKM.js +59 -0
  13. package/dist/chunk-VJN3HXKM.js.map +1 -0
  14. package/dist/chunk-ZZ45WAVR.js +20 -0
  15. package/dist/chunk-ZZ45WAVR.js.map +1 -0
  16. package/dist/config.d.ts +78 -0
  17. package/dist/config.js +3 -0
  18. package/dist/config.js.map +1 -0
  19. package/dist/dev.d.ts +6 -0
  20. package/dist/dev.js +84 -0
  21. package/dist/dev.js.map +1 -0
  22. package/dist/env.d.ts +17 -0
  23. package/dist/env.js +3 -0
  24. package/dist/env.js.map +1 -0
  25. package/dist/index.d.ts +12 -0
  26. package/dist/index.js +421 -0
  27. package/dist/index.js.map +1 -0
  28. package/dist/internal/assert-mdx-only.d.ts +1 -0
  29. package/dist/internal/microlighter-grammars.d.ts +3 -0
  30. package/dist/internal/pagefind.d.ts +2 -0
  31. package/dist/internal/rehype-base-url.d.ts +5 -0
  32. package/dist/internal/rehype-base-url.js +3 -0
  33. package/dist/internal/rehype-base-url.js.map +1 -0
  34. package/dist/internal/rehype-code-fence.d.ts +1 -0
  35. package/dist/internal/rehype-prose-scope.d.ts +1 -0
  36. package/dist/internal/rehype-table-columns.d.ts +1 -0
  37. package/dist/internal/scan-consumer-pages.d.ts +7 -0
  38. package/dist/internal/virtual-config.d.ts +3 -0
  39. package/dist/loaders.d.ts +20 -0
  40. package/dist/loaders.js +85 -0
  41. package/dist/loaders.js.map +1 -0
  42. package/dist/nav.d.ts +57 -0
  43. package/dist/nav.js +222 -0
  44. package/dist/nav.js.map +1 -0
  45. package/dist/paths.d.ts +28 -0
  46. package/dist/paths.js +3 -0
  47. package/dist/paths.js.map +1 -0
  48. package/dist/runtime/chrome/GlobalSearch.module.css +26 -0
  49. package/dist/runtime/chrome/GlobalSearch.tsx +422 -0
  50. package/dist/runtime/chrome/Header.astro +105 -0
  51. package/dist/runtime/chrome/LinkIcon.astro +35 -0
  52. package/dist/runtime/chrome/NavDrawer.astro +60 -0
  53. package/dist/runtime/chrome/NavTree.astro +112 -0
  54. package/dist/runtime/chrome/NotFoundBody.tsx +12 -0
  55. package/dist/runtime/chrome/PageFooter.astro +80 -0
  56. package/dist/runtime/chrome/Prose.astro +169 -0
  57. package/dist/runtime/chrome/Sidebar.astro +21 -0
  58. package/dist/runtime/chrome/TableOfContents.astro +86 -0
  59. package/dist/runtime/chrome/ThemeToggle.tsx +85 -0
  60. package/dist/runtime/chrome/TocElbow.astro +30 -0
  61. package/dist/runtime/chrome/TocList.astro +43 -0
  62. package/dist/runtime/components/AlertBridge.astro +16 -0
  63. package/dist/runtime/components/CodeFence.astro +38 -0
  64. package/dist/runtime/components/CodeFenceBridge.astro +20 -0
  65. package/dist/runtime/components/Link.astro +21 -0
  66. package/dist/runtime/components/TableBridge.astro +18 -0
  67. package/dist/runtime/components/index.ts +2 -0
  68. package/dist/runtime/layouts/DocsPage.astro +50 -0
  69. package/dist/runtime/layouts/DocsShell.astro +92 -0
  70. package/dist/runtime/lib/mdx-components.ts +43 -0
  71. package/dist/runtime/lib/nav-data.ts +74 -0
  72. package/dist/runtime/lib/summary.ts +57 -0
  73. package/dist/runtime/lib/theme.ts +84 -0
  74. package/dist/runtime/routes/docs-md.ts +33 -0
  75. package/dist/runtime/routes/docs.astro +92 -0
  76. package/dist/runtime/routes/llms-txt.ts +38 -0
  77. package/dist/runtime/routes/not-found.astro +16 -0
  78. package/dist/runtime/scripts/eq-copy.ts +27 -0
  79. package/dist/runtime/scripts/eq-highlight.ts +24 -0
  80. package/dist/runtime/scripts/eq-nav-drawer.ts +31 -0
  81. package/dist/runtime/scripts/eq-nav-group.ts +52 -0
  82. package/dist/runtime/scripts/eq-toc.ts +166 -0
  83. package/dist/runtime/styles/chrome.css +30 -0
  84. package/dist/runtime/styles/docs.css +21 -0
  85. package/dist/runtime/styles/prose.css +102 -0
  86. package/dist/runtime/styles/theme.css +2 -0
  87. package/dist/runtime/styles/utilities.css +38 -0
  88. package/dist/schema.d.ts +110 -0
  89. package/dist/schema.js +3 -0
  90. package/dist/schema.js.map +1 -0
  91. package/dist/types.d.ts +60 -0
  92. package/dist/types.js +3 -0
  93. package/dist/types.js.map +1 -0
  94. package/package.json +127 -0
package/dist/index.js ADDED
@@ -0,0 +1,421 @@
1
+ import './chunk-55J6XMHW.js';
2
+ import { rehypeBaseUrl } from './chunk-GSSSQTEV.js';
3
+ import { resolveConfig } from './chunk-ATIOPYKE.js';
4
+ export { resolveConfig } from './chunk-ATIOPYKE.js';
5
+ import { resolveDocsEnv } from './chunk-ZZ45WAVR.js';
6
+ export { resolveDocsEnv } from './chunk-ZZ45WAVR.js';
7
+ export { badgeSchema, docsSchema, groupSchema } from './chunk-IWKZQ4CW.js';
8
+ import path3 from 'path';
9
+ import { fileURLToPath } from 'url';
10
+ import { globSync } from 'tinyglobby';
11
+ import fs, { readdirSync, readFileSync } from 'fs';
12
+ import { createRequire } from 'module';
13
+ import { visit, SKIP } from 'unist-util-visit';
14
+
15
+ function assertMdxOnly(contentDir) {
16
+ const dir = fileURLToPath(contentDir);
17
+ let strays = [];
18
+ try {
19
+ strays = globSync(["**/*.md"], { cwd: dir, absolute: false });
20
+ } catch {
21
+ return;
22
+ }
23
+ if (strays.length === 0) return;
24
+ const list = strays.sort().map((file) => ` - ${file} -> ${file.replace(/\.md$/i, ".mdx")}`).join("\n");
25
+ throw new Error(
26
+ `[@eqtylab/docs] Found ${strays.length} Markdown file${strays.length > 1 ? "s" : ""} in ${path3.relative(process.cwd(), dir) || dir}:
27
+ ${list}
28
+
29
+ Docs content must be .mdx. Only MDX supports the component overrides that render
30
+ tables, code fences and callouts through Equality, so a .md page would look
31
+ different from every other page. Renaming is usually the only change needed --
32
+ MDX is a superset of Markdown.`
33
+ );
34
+ }
35
+ var GRAMMAR_IMPORT = "grammars/${";
36
+ function findGrammarDir(projectRoot) {
37
+ const requireFromProject = createRequire(new URL("package.json", projectRoot));
38
+ const equalityEntry = requireFromProject.resolve("@eqtylab/equality");
39
+ const requireFromEquality = createRequire(equalityEntry);
40
+ return path3.resolve(path3.dirname(requireFromEquality.resolve("microlighter")), "grammars");
41
+ }
42
+ function microlighterGrammarsPlugin(projectRoot, logger) {
43
+ return {
44
+ name: "eqty-docs:microlighter-grammars",
45
+ apply: "build",
46
+ generateBundle(_options, bundle) {
47
+ const directories = new Set(
48
+ Object.values(bundle).filter((output) => output.type === "chunk" && output.code.includes(GRAMMAR_IMPORT)).map((output) => path3.posix.dirname(output.fileName))
49
+ );
50
+ if (directories.size === 0) return;
51
+ let grammarDir;
52
+ let grammars;
53
+ try {
54
+ grammarDir = findGrammarDir(projectRoot);
55
+ grammars = readdirSync(grammarDir).filter((file) => file.endsWith(".js"));
56
+ } catch (error) {
57
+ logger.warn(
58
+ `Code blocks ask for microlighter grammars, but they could not be resolved. Fenced code will render unhighlighted. Check that @eqtylab/equality is installed in this project.
59
+ ${String(error)}`
60
+ );
61
+ return;
62
+ }
63
+ for (const directory of directories) {
64
+ for (const grammar of grammars) {
65
+ this.emitFile({
66
+ type: "asset",
67
+ fileName: directory === "." ? `grammars/${grammar}` : `${directory}/grammars/${grammar}`,
68
+ source: readFileSync(path3.resolve(grammarDir, grammar), "utf8")
69
+ });
70
+ }
71
+ }
72
+ }
73
+ };
74
+ }
75
+ var INDEX_DIR = "pagefind";
76
+ var MIME = {
77
+ ".js": "text/javascript",
78
+ ".css": "text/css",
79
+ ".json": "application/json",
80
+ ".wasm": "application/wasm"
81
+ };
82
+ function failOn(errors, logger, what) {
83
+ if (!errors.length) return;
84
+ errors.forEach((error) => logger.error(error));
85
+ throw new Error(`[@eqtylab/docs] Pagefind could not ${what}.`);
86
+ }
87
+ function indexRequest(url, base) {
88
+ if (!url) return null;
89
+ const pathname = decodeURIComponent(url.split(/[?#]/)[0]);
90
+ const prefix = `${base.replace(/\/+$/, "")}/${INDEX_DIR}/`;
91
+ return pathname.startsWith(prefix) ? pathname.slice(prefix.length) : null;
92
+ }
93
+ function pagefindIntegration() {
94
+ let indexDir = "";
95
+ return {
96
+ name: "@eqtylab/docs/pagefind",
97
+ hooks: {
98
+ "astro:config:setup"({ config, logger }) {
99
+ indexDir = path3.join(fileURLToPath(config.outDir), INDEX_DIR);
100
+ if (config.output === "server") {
101
+ logger.warn(
102
+ 'Output "server" emits no static HTML, so there is nothing for Pagefind to index.'
103
+ );
104
+ }
105
+ },
106
+ /** Runs ahead of Vite's static middleware and Astro's handler; move it and `/pagefind/*` 404s. */
107
+ "astro:server:setup"({ server, logger }) {
108
+ const base = server.config.base ?? "/";
109
+ logger.info(
110
+ fs.existsSync(indexDir) ? "serving the search index from the last build; rebuild to pick up edits" : "no search index yet \u2014 run `astro build` once to search in dev"
111
+ );
112
+ server.middlewares.use((req, res, next) => {
113
+ const requested = indexRequest(req.url, base);
114
+ if (requested === null) return next();
115
+ const file = path3.join(indexDir, requested);
116
+ if (!file.startsWith(indexDir + path3.sep) || !fs.existsSync(file)) return next();
117
+ res.setHeader("Content-Type", MIME[path3.extname(file)] ?? "application/octet-stream");
118
+ res.setHeader("Cache-Control", "no-store");
119
+ fs.createReadStream(file).pipe(res);
120
+ });
121
+ },
122
+ /** The last hook of the build, and the first moment every page exists on disk to read. */
123
+ async "astro:build:done"({ dir, logger }) {
124
+ const outDir = fileURLToPath(dir);
125
+ const { createIndex } = await import('pagefind');
126
+ const { index, errors } = await createIndex();
127
+ failOn(errors, logger, "create an index");
128
+ if (!index) throw new Error("[@eqtylab/docs] Pagefind returned no index.");
129
+ const { page_count, errors: addErrors } = await index.addDirectory({ path: outDir });
130
+ failOn(addErrors, logger, "index the built output");
131
+ const { outputPath, errors: writeErrors } = await index.writeFiles({
132
+ outputPath: path3.join(outDir, INDEX_DIR)
133
+ });
134
+ failOn(writeErrors, logger, "write the index");
135
+ logger.info(`indexed ${page_count} pages to ${outputPath}`);
136
+ }
137
+ }
138
+ };
139
+ }
140
+ function textOf(node) {
141
+ if (node.type === "text") return node.value ?? "";
142
+ return (node.children ?? []).map(textOf).join("");
143
+ }
144
+ function classNames(props) {
145
+ const raw = props?.className ?? props?.class;
146
+ if (Array.isArray(raw)) return raw.map(String);
147
+ if (typeof raw === "string") return raw.split(/\s+/);
148
+ return [];
149
+ }
150
+ function titleFromMeta(meta) {
151
+ const match = meta?.match(/(?:^|\s)title=(?:"([^"]*)"|'([^']*)'|(\S+))/);
152
+ return match ? match[1] ?? match[2] ?? match[3] : void 0;
153
+ }
154
+ function rehypeCodeFence() {
155
+ return function transformer(tree) {
156
+ visit(tree, "element", (node) => {
157
+ if (node.tagName !== "pre") return;
158
+ const code = (node.children ?? []).find(
159
+ (child) => child.type === "element" && child.tagName === "code"
160
+ );
161
+ if (!code) return;
162
+ const language = classNames(code.properties).find((name) => name.startsWith("language-"))?.slice("language-".length);
163
+ const title = titleFromMeta(code.data?.meta);
164
+ node.properties = {
165
+ ...node.properties,
166
+ dataCode: textOf(code).replace(/\n$/, ""),
167
+ ...language ? { dataLanguage: language } : {},
168
+ ...title ? { dataTitle: title } : {}
169
+ };
170
+ });
171
+ };
172
+ }
173
+ var MARKER = "data-eq-md";
174
+ function isComponent(node) {
175
+ if (node.type !== "mdxJsxFlowElement" && node.type !== "mdxJsxTextElement") return false;
176
+ const name = node.name;
177
+ return typeof name === "string" && (/^[A-Z]/.test(name) || name.includes("."));
178
+ }
179
+ function rehypeProseScope() {
180
+ return function transformer(tree) {
181
+ visit(tree, (node) => {
182
+ if (isComponent(node)) return SKIP;
183
+ if (node.type === "element") {
184
+ node.properties = { ...node.properties, dataEqMd: "" };
185
+ return void 0;
186
+ }
187
+ if ((node.type === "mdxJsxFlowElement" || node.type === "mdxJsxTextElement") && node.name) {
188
+ const attributes = node.attributes ?? [];
189
+ if (!attributes.some((a) => a.type === "mdxJsxAttribute" && a.name === MARKER)) {
190
+ attributes.push({ type: "mdxJsxAttribute", name: MARKER, value: "" });
191
+ }
192
+ node.attributes = attributes;
193
+ }
194
+ return void 0;
195
+ });
196
+ };
197
+ }
198
+ function firstRow(table) {
199
+ let found;
200
+ visit(table, "element", (node) => {
201
+ if (found) return false;
202
+ if (node.tagName === "tr") {
203
+ found = node;
204
+ return false;
205
+ }
206
+ return void 0;
207
+ });
208
+ return found;
209
+ }
210
+ function countCells(row) {
211
+ return (row.children ?? []).reduce((total, child) => {
212
+ if (child.type !== "element") return total;
213
+ if (child.tagName !== "th" && child.tagName !== "td") return total;
214
+ const span = Number(child.properties?.colSpan ?? child.properties?.colspan ?? 1);
215
+ return total + (Number.isFinite(span) && span > 0 ? span : 1);
216
+ }, 0);
217
+ }
218
+ function rehypeTableColumns() {
219
+ return function transformer(tree) {
220
+ visit(tree, "element", (node) => {
221
+ if (node.tagName !== "table") return;
222
+ const row = firstRow(node);
223
+ const count = row ? countCells(row) : 0;
224
+ if (count <= 0) return;
225
+ node.properties = { ...node.properties, dataColumnCount: String(count) };
226
+ });
227
+ };
228
+ }
229
+ var PAGE_EXTENSIONS = ["astro", "md", "mdx", "html", "ts", "js"];
230
+ function toRoutePath(relative) {
231
+ const withoutExt = relative.replace(/\.[^./]+$/, "");
232
+ const segments = withoutExt.split(path3.sep).join("/").split("/").filter(Boolean);
233
+ if (segments.at(-1) === "index") segments.pop();
234
+ return "/" + segments.join("/");
235
+ }
236
+ function scanConsumerPages(srcDir) {
237
+ const pagesDir = fileURLToPath(new URL("./pages/", srcDir));
238
+ let files = [];
239
+ try {
240
+ files = globSync([`**/*.{${PAGE_EXTENSIONS.join(",")}}`], {
241
+ cwd: pagesDir,
242
+ absolute: false
243
+ });
244
+ } catch {
245
+ return { ownedPaths: [], claimedPatterns: /* @__PURE__ */ new Set() };
246
+ }
247
+ const ownedPaths = [];
248
+ const claimedPatterns = /* @__PURE__ */ new Set();
249
+ for (const file of files) {
250
+ if (file.split(path3.sep).some((segment) => segment.startsWith("_"))) continue;
251
+ const routePath = toRoutePath(file);
252
+ claimedPatterns.add(routePath === "" ? "/" : routePath);
253
+ if (!/[[\]]/.test(file)) {
254
+ ownedPaths.push(routePath.replace(/\/+$/, "") || "/");
255
+ }
256
+ }
257
+ return { ownedPaths, claimedPatterns };
258
+ }
259
+
260
+ // src/internal/virtual-config.ts
261
+ var MODULE_ID = "virtual:eqty-docs/config";
262
+ var RESOLVED_ID = "\0" + MODULE_ID;
263
+ function virtualConfigPlugin(getPayload) {
264
+ return {
265
+ name: "eqty-docs:virtual-config",
266
+ resolveId(id) {
267
+ return id === MODULE_ID ? RESOLVED_ID : null;
268
+ },
269
+ load(id) {
270
+ if (id !== RESOLVED_ID) return null;
271
+ return `export default ${JSON.stringify(getPayload())};`;
272
+ }
273
+ };
274
+ }
275
+
276
+ // src/index.ts
277
+ function plannedRoutes(cfg) {
278
+ const prefix = cfg.pathPrefix ? `/${cfg.pathPrefix.replace(/^\/|\/$/g, "")}` : "";
279
+ const routes = [
280
+ {
281
+ pattern: `${prefix}/[...slug]`,
282
+ entrypoint: "@eqtylab/docs/routes/docs.astro",
283
+ enabled: cfg.routing.injectPages
284
+ },
285
+ {
286
+ pattern: `${prefix}/[...slug].md`,
287
+ entrypoint: "@eqtylab/docs/routes/docs-md.ts",
288
+ enabled: cfg.routing.markdownTwins
289
+ },
290
+ {
291
+ pattern: "/llms.txt",
292
+ entrypoint: "@eqtylab/docs/routes/llms-txt.ts",
293
+ enabled: cfg.routing.markdownTwins
294
+ },
295
+ {
296
+ pattern: "/404",
297
+ entrypoint: "@eqtylab/docs/routes/not-found.astro",
298
+ enabled: cfg.routing.notFound
299
+ }
300
+ ];
301
+ return routes.filter((r) => r.enabled);
302
+ }
303
+ function docs(options = {}) {
304
+ const { env: envOverrides, ...userConfig } = options;
305
+ const cfg = resolveConfig(userConfig);
306
+ const env = resolveDocsEnv(envOverrides);
307
+ let payload = {};
308
+ return {
309
+ name: "@eqtylab/docs",
310
+ hooks: {
311
+ async "astro:config:setup"(params) {
312
+ const { config, injectRoute, updateConfig, addWatchFile, logger, command } = params;
313
+ assertMdxOnly(new URL(`./${cfg.contentDir}/`, config.srcDir));
314
+ const consumer = scanConsumerPages(config.srcDir);
315
+ for (const route of plannedRoutes(cfg)) {
316
+ if (consumer.claimedPatterns.has(route.pattern)) {
317
+ logger.info(
318
+ `yielding ${route.pattern} to your own src/pages file (docs route not injected)`
319
+ );
320
+ continue;
321
+ }
322
+ injectRoute({ pattern: route.pattern, entrypoint: route.entrypoint, prerender: true });
323
+ }
324
+ payload = {
325
+ ...cfg,
326
+ env,
327
+ // Read by the catch-all's getStaticPaths so no path is emitted twice.
328
+ ownedByConsumer: consumer.ownedPaths
329
+ };
330
+ if (command === "dev") {
331
+ addWatchFile(new URL(`./${cfg.contentDir}/`, config.srcDir));
332
+ }
333
+ const integrationNames = new Set(config.integrations.map((i) => i.name));
334
+ const added = [];
335
+ if (cfg.autoIntegrations) {
336
+ if (!integrationNames.has("@astrojs/mdx")) {
337
+ const { default: mdx } = await import('@astrojs/mdx');
338
+ added.push(mdx());
339
+ }
340
+ if (!integrationNames.has("@astrojs/react")) {
341
+ const { default: react } = await import('@astrojs/react');
342
+ added.push(react());
343
+ }
344
+ if (cfg.search.provider === "pagefind" && !integrationNames.has("pagefind")) {
345
+ added.push(pagefindIntegration());
346
+ }
347
+ }
348
+ const vitePlugins = [virtualConfigPlugin(() => payload)];
349
+ if (cfg.code.highlighter === "codeblock") {
350
+ vitePlugins.push(microlighterGrammarsPlugin(config.root, logger));
351
+ }
352
+ if (cfg.autoIntegrations) {
353
+ const existing = config.vite?.plugins ?? [];
354
+ const hasTailwind = existing.flat(Infinity).some(
355
+ (p) => typeof p?.name === "string" && p.name.includes("tailwind")
356
+ );
357
+ if (!hasTailwind) {
358
+ const { default: tailwindcss } = await import('@tailwindcss/vite');
359
+ vitePlugins.push(tailwindcss());
360
+ }
361
+ }
362
+ const markdown = cfg.code.highlighter === "codeblock" ? {
363
+ // Shiki must be off so the `pre` override receives raw source.
364
+ syntaxHighlight: false
365
+ } : {
366
+ shikiConfig: {
367
+ themes: cfg.code.themes,
368
+ defaultColor: false,
369
+ wrap: cfg.code.wrap,
370
+ ...cfg.code.langs.length ? { langs: cfg.code.langs } : {}
371
+ }
372
+ };
373
+ markdown.rehypePlugins = [
374
+ [rehypeBaseUrl, { base: config.base }],
375
+ rehypeProseScope,
376
+ rehypeTableColumns,
377
+ ...cfg.code.highlighter === "codeblock" ? [rehypeCodeFence] : []
378
+ ];
379
+ updateConfig({
380
+ integrations: added,
381
+ vite: { plugins: vitePlugins },
382
+ markdown
383
+ });
384
+ },
385
+ "astro:config:done"({ injectTypes }) {
386
+ injectTypes({
387
+ filename: "types.d.ts",
388
+ content: [
389
+ `declare module 'virtual:eqty-docs/config' {`,
390
+ ` const config: import('@eqtylab/docs').DocsConfig & {`,
391
+ ` env: import('@eqtylab/docs').DocsEnv;`,
392
+ ` ownedByConsumer: string[];`,
393
+ ` };`,
394
+ ` export default config;`,
395
+ `}`,
396
+ ""
397
+ ].join("\n")
398
+ });
399
+ },
400
+ "astro:routes:resolved"({ routes, logger }) {
401
+ const seen = /* @__PURE__ */ new Map();
402
+ for (const route of routes) {
403
+ const previous = seen.get(route.pattern);
404
+ if (previous && previous !== route.entrypoint) {
405
+ logger.warn(
406
+ `Route ${route.pattern} is claimed twice:
407
+ ${previous}
408
+ ${route.entrypoint}
409
+ One of them will be overwritten in the static build.`
410
+ );
411
+ }
412
+ seen.set(route.pattern, route.entrypoint);
413
+ }
414
+ }
415
+ }
416
+ };
417
+ }
418
+
419
+ export { docs as default };
420
+ //# sourceMappingURL=index.js.map
421
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/internal/assert-mdx-only.ts","../src/internal/microlighter-grammars.ts","../src/internal/pagefind.ts","../src/internal/rehype-code-fence.ts","../src/internal/rehype-prose-scope.ts","../src/internal/rehype-table-columns.ts","../src/internal/scan-consumer-pages.ts","../src/internal/virtual-config.ts","../src/index.ts"],"names":["path","fileURLToPath","visit","globSync"],"mappings":";;;;;;;;;;;;;;AAQO,SAAS,cAAc,UAAA,EAAuB;AACnD,EAAA,MAAM,GAAA,GAAM,cAAc,UAAU,CAAA;AAEpC,EAAA,IAAI,SAAmB,EAAC;AACxB,EAAA,IAAI;AACF,IAAA,MAAA,GAAS,QAAA,CAAS,CAAC,SAAS,CAAA,EAAG,EAAE,GAAA,EAAK,GAAA,EAAK,QAAA,EAAU,KAAA,EAAO,CAAA;AAAA,EAC9D,CAAA,CAAA,MAAQ;AACN,IAAA;AAAA,EACF;AACA,EAAA,IAAI,MAAA,CAAO,WAAW,CAAA,EAAG;AAEzB,EAAA,MAAM,OAAO,MAAA,CACV,IAAA,GACA,GAAA,CAAI,CAAC,SAAS,CAAA,IAAA,EAAO,IAAI,CAAA,MAAA,EAAS,IAAA,CAAK,QAAQ,QAAA,EAAU,MAAM,CAAC,CAAA,CAAE,CAAA,CAClE,KAAK,IAAI,CAAA;AAEZ,EAAA,MAAM,IAAI,KAAA;AAAA,IACR,yBAAyB,MAAA,CAAO,MAAM,CAAA,cAAA,EAAiB,MAAA,CAAO,SAAS,CAAA,GAAI,GAAA,GAAM,EAAE,CAAA,IAAA,EAC9EA,MAAK,QAAA,CAAS,OAAA,CAAQ,KAAI,EAAG,GAAG,KAAK,GAAG,CAAA;AAAA,EAAM,IAAI;;AAAA;AAAA;AAAA;AAAA,8BAAA;AAAA,GAKzD;AACF;ACpBA,IAAM,cAAA,GA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,EAAE,WAAA,EAAY,EAAG;AACnC,QAAA,WAAA,CAAY;AAAA,UACV,QAAA,EAAU,YAAA;AAAA,UACV,OAAA,EAAS;AAAA,YACP,CAAA,2CAAA,CAAA;AAAA,YACA,CAAA,sDAAA,CAAA;AAAA,YACA,CAAA,yCAAA,CAAA;AAAA,YACA,CAAA,8BAAA,CAAA;AAAA,YACA,CAAA,IAAA,CAAA;AAAA,YACA,CAAA,wBAAA,CAAA;AAAA,YACA,CAAA,CAAA,CAAA;AAAA,YACA;AAAA,WACF,CAAE,KAAK,IAAI;AAAA,SACZ,CAAA;AAAA,MACH,CAAA;AAAA,MAEA,uBAAA,CAAwB,EAAE,MAAA,EAAQ,MAAA,EAAO,EAAG;AAE1C,QAAA,MAAM,IAAA,uBAAW,GAAA,EAAoB;AACrC,QAAA,KAAA,MAAW,SAAS,MAAA,EAA0D;AAC5E,UAAA,MAAM,QAAA,GAAW,IAAA,CAAK,GAAA,CAAI,KAAA,CAAM,OAAO,CAAA;AACvC,UAAA,IAAI,QAAA,IAAY,QAAA,KAAa,KAAA,CAAM,UAAA,EAAY;AAC7C,YAAA,MAAA,CAAO,IAAA;AAAA,cACL,CAAA,MAAA,EAAS,MAAM,OAAO,CAAA;AAAA,EAAA,EAAyB,QAAQ;AAAA,EAAA,EAAO,MAAM,UAAU;AAAA,oDAAA;AAAA,aAEhF;AAAA,UACF;AACA,UAAA,IAAA,CAAK,GAAA,CAAI,KAAA,CAAM,OAAA,EAAS,KAAA,CAAM,UAAU,CAAA;AAAA,QAC1C;AAAA,MACF;AAAA;AACF,GACF;AACF","file":"index.js","sourcesContent":["/**\n * Only MDX supports the component overrides and the loader globs `.mdx` only,\n * so a stray `.md` would be silently absent from the site. Fail loudly instead.\n */\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { globSync } from 'tinyglobby';\n\nexport function assertMdxOnly(contentDir: URL): void {\n const dir = fileURLToPath(contentDir);\n\n let strays: string[] = [];\n try {\n strays = globSync(['**/*.md'], { cwd: dir, absolute: false });\n } catch {\n return;\n }\n if (strays.length === 0) return;\n\n const list = strays\n .sort()\n .map((file) => ` - ${file} -> ${file.replace(/\\.md$/i, '.mdx')}`)\n .join('\\n');\n\n throw new Error(\n `[@eqtylab/docs] Found ${strays.length} Markdown file${strays.length > 1 ? 's' : ''} in ` +\n `${path.relative(process.cwd(), dir) || dir}:\\n${list}\\n\\n` +\n `Docs content must be .mdx. Only MDX supports the component overrides that render\\n` +\n `tables, code fences and callouts through Equality, so a .md page would look\\n` +\n `different from every other page. Renaming is usually the only change needed --\\n` +\n `MDX is a superset of Markdown.`\n );\n}\n","/**\n * Emits microlighter's grammar modules beside the chunks that ask for them.\n * CodeBlock loads grammars with `import('./grammars/' + language)`, which no\n * bundler can expand; without this the build succeeds and code renders unhighlighted.\n */\nimport { readdirSync, readFileSync } from 'node:fs';\nimport { createRequire } from 'node:module';\nimport path from 'node:path';\nimport type { AstroIntegrationLogger } from 'astro';\nimport type { Plugin } from 'vite';\n\n/** Residue of the dynamic import in the emitted chunk. */\nconst GRAMMAR_IMPORT = 'grammars/${';\n\n/** Two hops from the consumer: microlighter is a dependency of @eqtylab/equality, which is only a peer here. */\nfunction findGrammarDir(projectRoot: URL): string {\n const requireFromProject = createRequire(new URL('package.json', projectRoot));\n const equalityEntry = requireFromProject.resolve('@eqtylab/equality');\n const requireFromEquality = createRequire(equalityEntry);\n return path.resolve(path.dirname(requireFromEquality.resolve('microlighter')), 'grammars');\n}\n\nexport function microlighterGrammarsPlugin(\n projectRoot: URL,\n logger: AstroIntegrationLogger\n): Plugin {\n return {\n name: 'eqty-docs:microlighter-grammars',\n apply: 'build',\n generateBundle(_options, bundle) {\n const directories = new Set(\n Object.values(bundle)\n .filter((output) => output.type === 'chunk' && output.code.includes(GRAMMAR_IMPORT))\n .map((output) => path.posix.dirname(output.fileName))\n );\n if (directories.size === 0) return;\n\n let grammarDir: string;\n let grammars: string[];\n try {\n grammarDir = findGrammarDir(projectRoot);\n grammars = readdirSync(grammarDir).filter((file) => file.endsWith('.js'));\n } catch (error) {\n // Warn rather than fail the build over highlighting.\n logger.warn(\n 'Code blocks ask for microlighter grammars, but they could not be resolved. ' +\n 'Fenced code will render unhighlighted. Check that @eqtylab/equality is ' +\n `installed in this project.\\n ${String(error)}`\n );\n return;\n }\n\n for (const directory of directories) {\n for (const grammar of grammars) {\n this.emitFile({\n type: 'asset',\n fileName:\n directory === '.' ? `grammars/${grammar}` : `${directory}/grammars/${grammar}`,\n source: readFileSync(path.resolve(grammarDir, grammar), 'utf8'),\n });\n }\n }\n },\n };\n}\n","/**\n * Not `astro-pagefind`: it ships TypeScript, and Node will not compile that under\n * node_modules when this integration reaches it from its own bundle.\n *\n * The build writes the index; dev serves that same index off disk, so it always\n * describes the last build.\n */\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport type { AstroIntegration } from 'astro';\n\nconst INDEX_DIR = 'pagefind';\n\n/** Everything else Pagefind fetches is read as bytes, so the type never reaches a parser. */\nconst MIME: Record<string, string> = {\n '.js': 'text/javascript',\n '.css': 'text/css',\n '.json': 'application/json',\n '.wasm': 'application/wasm',\n};\n\n/** Pagefind collects errors per step and carries on; any of them means no usable index. */\nfunction failOn(\n errors: string[],\n logger: { error: (message: string) => void },\n what: string\n): void {\n if (!errors.length) return;\n errors.forEach((error) => logger.error(error));\n throw new Error(`[@eqtylab/docs] Pagefind could not ${what}.`);\n}\n\nfunction indexRequest(url: string | undefined, base: string): string | null {\n if (!url) return null;\n const pathname = decodeURIComponent(url.split(/[?#]/)[0]);\n const prefix = `${base.replace(/\\/+$/, '')}/${INDEX_DIR}/`;\n return pathname.startsWith(prefix) ? pathname.slice(prefix.length) : null;\n}\n\nexport function pagefindIntegration(): AstroIntegration {\n let indexDir = '';\n\n return {\n name: '@eqtylab/docs/pagefind',\n hooks: {\n 'astro:config:setup'({ config, logger }) {\n indexDir = path.join(fileURLToPath(config.outDir), INDEX_DIR);\n\n if (config.output === 'server') {\n logger.warn(\n 'Output \"server\" emits no static HTML, so there is nothing for Pagefind to index.'\n );\n }\n },\n\n /** Runs ahead of Vite's static middleware and Astro's handler; move it and `/pagefind/*` 404s. */\n 'astro:server:setup'({ server, logger }) {\n const base = server.config.base ?? '/';\n\n logger.info(\n fs.existsSync(indexDir)\n ? 'serving the search index from the last build; rebuild to pick up edits'\n : 'no search index yet — run `astro build` once to search in dev'\n );\n\n server.middlewares.use((req, res, next) => {\n const requested = indexRequest(req.url, base);\n if (requested === null) return next();\n\n const file = path.join(indexDir, requested);\n // The prefix check is what stops `..` climbing out of the index directory.\n if (!file.startsWith(indexDir + path.sep) || !fs.existsSync(file)) return next();\n\n res.setHeader('Content-Type', MIME[path.extname(file)] ?? 'application/octet-stream');\n // The next build rewrites these in place, and a cached fragment would outlive it.\n res.setHeader('Cache-Control', 'no-store');\n fs.createReadStream(file).pipe(res);\n });\n },\n\n /** The last hook of the build, and the first moment every page exists on disk to read. */\n async 'astro:build:done'({ dir, logger }) {\n const outDir = fileURLToPath(dir);\n const { createIndex } = await import('pagefind');\n\n const { index, errors } = await createIndex();\n failOn(errors, logger, 'create an index');\n if (!index) throw new Error('[@eqtylab/docs] Pagefind returned no index.');\n\n const { page_count, errors: addErrors } = await index.addDirectory({ path: outDir });\n failOn(addErrors, logger, 'index the built output');\n\n const { outputPath, errors: writeErrors } = await index.writeFiles({\n outputPath: path.join(outDir, INDEX_DIR),\n });\n failOn(writeErrors, logger, 'write the index');\n\n logger.info(`indexed ${page_count} pages to ${outputPath}`);\n },\n },\n };\n}\n","/**\n * Lifts each fence's source, language and title onto its `<pre>`. Do not recover\n * the source from the rendered slot: `Astro.slots.render()` escapes in dev but not in build.\n */\nimport { visit } from 'unist-util-visit';\n\ninterface Node {\n type: string;\n tagName?: string;\n value?: string;\n properties?: Record<string, unknown>;\n children?: Node[];\n data?: { meta?: string };\n}\n\nfunction textOf(node: Node): string {\n if (node.type === 'text') return node.value ?? '';\n return (node.children ?? []).map(textOf).join('');\n}\n\nfunction classNames(props: Record<string, unknown> | undefined): string[] {\n const raw = props?.className ?? props?.class;\n if (Array.isArray(raw)) return raw.map(String);\n if (typeof raw === 'string') return raw.split(/\\s+/);\n return [];\n}\n\n/** ```ts title=\"button.tsx\" -> \"button.tsx\" */\nfunction titleFromMeta(meta: string | undefined): string | undefined {\n const match = meta?.match(/(?:^|\\s)title=(?:\"([^\"]*)\"|'([^']*)'|(\\S+))/);\n return match ? (match[1] ?? match[2] ?? match[3]) : undefined;\n}\n\nexport function rehypeCodeFence() {\n return function transformer(tree: unknown) {\n visit(tree as never, 'element', (node: Node) => {\n if (node.tagName !== 'pre') return;\n\n const code = (node.children ?? []).find(\n (child) => child.type === 'element' && child.tagName === 'code'\n );\n if (!code) return;\n\n const language = classNames(code.properties)\n .find((name) => name.startsWith('language-'))\n ?.slice('language-'.length);\n\n const title = titleFromMeta(code.data?.meta);\n\n node.properties = {\n ...node.properties,\n dataCode: textOf(code).replace(/\\n$/, ''),\n ...(language ? { dataLanguage: language } : {}),\n ...(title ? { dataTitle: title } : {}),\n };\n });\n };\n}\n","/**\n * Marks the content a page authored as markdown or as plain HTML, so\n * `prose.css` can typeset it without reaching inside a component.\n *\n * MDX parses a component's children as markdown whenever they sit on their own\n * lines, so `<Badge icon=\"Shield\">\\n Primary\\n</Badge>` renders a `<p>` inside\n * the badge — and prettier puts them there. Authoring discipline cannot fix it;\n * the boundary has to be drawn here. Everything below a capitalised JSX tag is\n * that component's business, `<div>` and friends are the page's own.\n */\nimport { SKIP, visit } from 'unist-util-visit';\n\nconst MARKER = 'data-eq-md';\n\ninterface Attribute {\n type: string;\n name?: string | null;\n}\n\ninterface Node {\n type: string;\n name?: string | null;\n properties?: Record<string, unknown>;\n attributes?: Attribute[];\n}\n\n/** Capitalised or dotted JSX names are components; `div`, `span` and friends are not. */\nfunction isComponent(node: Node): boolean {\n if (node.type !== 'mdxJsxFlowElement' && node.type !== 'mdxJsxTextElement') return false;\n const name = node.name;\n return typeof name === 'string' && (/^[A-Z]/.test(name) || name.includes('.'));\n}\n\nexport function rehypeProseScope() {\n return function transformer(tree: unknown) {\n visit(tree as never, (node: Node) => {\n if (isComponent(node)) return SKIP;\n\n if (node.type === 'element') {\n node.properties = { ...node.properties, dataEqMd: '' };\n return undefined;\n }\n\n // Authored HTML. A JSX fragment has no name and nothing to mark.\n if ((node.type === 'mdxJsxFlowElement' || node.type === 'mdxJsxTextElement') && node.name) {\n const attributes = node.attributes ?? [];\n if (!attributes.some((a) => a.type === 'mdxJsxAttribute' && a.name === MARKER)) {\n attributes.push({ type: 'mdxJsxAttribute', name: MARKER, value: '' } as Attribute);\n }\n node.attributes = attributes;\n }\n\n return undefined;\n });\n };\n}\n","/**\n * Annotates each markdown table with its column count. Equality's `TableContainer`\n * is a CSS grid and collapses to one column without an explicit track list.\n */\nimport { visit } from 'unist-util-visit';\n\ninterface ElementNode {\n type: string;\n tagName?: string;\n properties?: Record<string, unknown>;\n children?: ElementNode[];\n}\n\n/** First `tr` in document order, searching thead before tbody. */\nfunction firstRow(table: ElementNode): ElementNode | undefined {\n let found: ElementNode | undefined;\n visit(table as never, 'element', (node: ElementNode) => {\n if (found) return false;\n if (node.tagName === 'tr') {\n found = node;\n return false;\n }\n return undefined;\n });\n return found;\n}\n\nfunction countCells(row: ElementNode): number {\n return (row.children ?? []).reduce((total, child) => {\n if (child.type !== 'element') return total;\n if (child.tagName !== 'th' && child.tagName !== 'td') return total;\n const span = Number(child.properties?.colSpan ?? child.properties?.colspan ?? 1);\n return total + (Number.isFinite(span) && span > 0 ? span : 1);\n }, 0);\n}\n\nexport function rehypeTableColumns() {\n return function transformer(tree: unknown) {\n visit(tree as never, 'element', (node: ElementNode) => {\n if (node.tagName !== 'table') return;\n const row = firstRow(node);\n const count = row ? countCells(row) : 0;\n if (count <= 0) return;\n node.properties = { ...node.properties, dataColumnCount: String(count) };\n });\n };\n}\n","/**\n * Routes the consumer's own `src/pages` already claim. Astro does NOT de-duplicate\n * injected routes against file-based ones: a path claimed by both is emitted\n * twice and the winner is write order, so yielding has to be explicit here.\n */\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { globSync } from 'tinyglobby';\n\nconst PAGE_EXTENSIONS = ['astro', 'md', 'mdx', 'html', 'ts', 'js'];\n\nexport interface ConsumerPages {\n /** Concrete route paths the consumer's pages generate, normalised without trailing slash. */\n ownedPaths: string[];\n /** Route patterns claimed by consumer pages, e.g. '/[...slug]' or '/404'. */\n claimedPatterns: Set<string>;\n}\n\n/** `index.astro` -> '', `a/b.astro` -> '/a/b', `[...slug].astro` -> '/[...slug]' */\nfunction toRoutePath(relative: string): string {\n const withoutExt = relative.replace(/\\.[^./]+$/, '');\n const segments = withoutExt.split(path.sep).join('/').split('/').filter(Boolean);\n if (segments.at(-1) === 'index') segments.pop();\n return '/' + segments.join('/');\n}\n\nexport function scanConsumerPages(srcDir: URL): ConsumerPages {\n const pagesDir = fileURLToPath(new URL('./pages/', srcDir));\n\n let files: string[] = [];\n try {\n files = globSync([`**/*.{${PAGE_EXTENSIONS.join(',')}}`], {\n cwd: pagesDir,\n absolute: false,\n });\n } catch {\n // No src/pages: a docs-only site.\n return { ownedPaths: [], claimedPatterns: new Set() };\n }\n\n const ownedPaths: string[] = [];\n const claimedPatterns = new Set<string>();\n\n for (const file of files) {\n // Astro ignores files and directories prefixed with `_`.\n if (file.split(path.sep).some((segment) => segment.startsWith('_'))) continue;\n\n const routePath = toRoutePath(file);\n claimedPatterns.add(routePath === '' ? '/' : routePath);\n\n if (!/[[\\]]/.test(file)) {\n ownedPaths.push(routePath.replace(/\\/+$/, '') || '/');\n }\n }\n\n return { ownedPaths, claimedPatterns };\n}\n","/** Serves the resolved config to runtime components, which ship from node_modules and cannot reach the consumer's project by path. */\nimport type { Plugin } from 'vite';\n\nconst MODULE_ID = 'virtual:eqty-docs/config';\nconst RESOLVED_ID = '\\0' + MODULE_ID;\n\nexport function virtualConfigPlugin(getPayload: () => Record<string, unknown>): Plugin {\n return {\n name: 'eqty-docs:virtual-config',\n resolveId(id) {\n return id === MODULE_ID ? RESOLVED_ID : null;\n },\n load(id) {\n if (id !== RESOLVED_ID) return null;\n return `export default ${JSON.stringify(getPayload())};`;\n },\n };\n}\n","import type { AstroIntegration } from 'astro';\n\nimport { resolveConfig, type DocsConfig, type DocsUserConfig } from './config.ts';\nimport { resolveDocsEnv, type DocsEnv } from './env.ts';\nimport { assertMdxOnly } from './internal/assert-mdx-only.ts';\nimport { microlighterGrammarsPlugin } from './internal/microlighter-grammars.ts';\nimport { pagefindIntegration } from './internal/pagefind.ts';\nimport { rehypeBaseUrl } from './internal/rehype-base-url.ts';\nimport { rehypeCodeFence } from './internal/rehype-code-fence.ts';\nimport { rehypeProseScope } from './internal/rehype-prose-scope.ts';\nimport { rehypeTableColumns } from './internal/rehype-table-columns.ts';\nimport { scanConsumerPages } from './internal/scan-consumer-pages.ts';\nimport { virtualConfigPlugin } from './internal/virtual-config.ts';\n\nexport { resolveConfig, type DocsConfig, type DocsUserConfig } from './config.ts';\nexport { resolveDocsEnv, type DocsEnv } from './env.ts';\n// Do not re-export the loaders: this entry runs in Node when astro.config loads,\n// and they import `astro:content`, which only exists in the Vite graph.\nexport { docsSchema, groupSchema, badgeSchema } from './schema.ts';\nexport * from './types.ts';\n\nexport interface DocsIntegrationOptions extends DocsUserConfig {\n /** Build environment for versioned deploys. Defaults to `resolveDocsEnv()`. */\n env?: Partial<DocsEnv>;\n}\n\n/** Route patterns the integration would like to own, paired with their entrypoints. */\nfunction plannedRoutes(cfg: DocsConfig) {\n const prefix = cfg.pathPrefix ? `/${cfg.pathPrefix.replace(/^\\/|\\/$/g, '')}` : '';\n const routes: Array<{ pattern: string; entrypoint: string; enabled: boolean }> = [\n {\n pattern: `${prefix}/[...slug]`,\n entrypoint: '@eqtylab/docs/routes/docs.astro',\n enabled: cfg.routing.injectPages,\n },\n {\n pattern: `${prefix}/[...slug].md`,\n entrypoint: '@eqtylab/docs/routes/docs-md.ts',\n enabled: cfg.routing.markdownTwins,\n },\n {\n pattern: '/llms.txt',\n entrypoint: '@eqtylab/docs/routes/llms-txt.ts',\n enabled: cfg.routing.markdownTwins,\n },\n {\n pattern: '/404',\n entrypoint: '@eqtylab/docs/routes/not-found.astro',\n enabled: cfg.routing.notFound,\n },\n ];\n return routes.filter((r) => r.enabled);\n}\n\nexport default function docs(\n options: DocsIntegrationOptions = {} as DocsIntegrationOptions\n): AstroIntegration {\n const { env: envOverrides, ...userConfig } = options;\n const cfg = resolveConfig(userConfig);\n const env = resolveDocsEnv(envOverrides);\n\n let payload: Record<string, unknown> = {};\n\n return {\n name: '@eqtylab/docs',\n hooks: {\n async 'astro:config:setup'(params) {\n const { config, injectRoute, updateConfig, addWatchFile, logger, command } = params;\n\n assertMdxOnly(new URL(`./${cfg.contentDir}/`, config.srcDir));\n\n const consumer = scanConsumerPages(config.srcDir);\n\n for (const route of plannedRoutes(cfg)) {\n if (consumer.claimedPatterns.has(route.pattern)) {\n logger.info(\n `yielding ${route.pattern} to your own src/pages file (docs route not injected)`\n );\n continue;\n }\n injectRoute({ pattern: route.pattern, entrypoint: route.entrypoint, prerender: true });\n }\n\n payload = {\n ...cfg,\n env,\n // Read by the catch-all's getStaticPaths so no path is emitted twice.\n ownedByConsumer: consumer.ownedPaths,\n };\n\n // So `_group.yaml` edits reload in dev.\n if (command === 'dev') {\n addWatchFile(new URL(`./${cfg.contentDir}/`, config.srcDir));\n }\n\n const integrationNames = new Set(config.integrations.map((i) => i.name));\n const added: AstroIntegration[] = [];\n\n if (cfg.autoIntegrations) {\n if (!integrationNames.has('@astrojs/mdx')) {\n const { default: mdx } = await import('@astrojs/mdx');\n added.push(mdx());\n }\n if (!integrationNames.has('@astrojs/react')) {\n const { default: react } = await import('@astrojs/react');\n added.push(react());\n }\n if (cfg.search.provider === 'pagefind' && !integrationNames.has('pagefind')) {\n added.push(pagefindIntegration());\n }\n }\n\n const vitePlugins: unknown[] = [virtualConfigPlugin(() => payload)];\n\n // Shiki tokenises at build time and needs no grammars emitted.\n if (cfg.code.highlighter === 'codeblock') {\n vitePlugins.push(microlighterGrammarsPlugin(config.root, logger));\n }\n\n if (cfg.autoIntegrations) {\n // Cast first: `.flat(Infinity)` over Vite's recursive PluginOption hits TS2589.\n const existing = (config.vite?.plugins ?? []) as unknown[];\n const hasTailwind = existing\n .flat(Infinity as 1)\n .some(\n (p) =>\n typeof (p as { name?: string })?.name === 'string' &&\n (p as { name: string }).name.includes('tailwind')\n );\n if (!hasTailwind) {\n const { default: tailwindcss } = await import('@tailwindcss/vite');\n vitePlugins.push(tailwindcss());\n }\n }\n\n // Typed loosely on purpose: inlining this hits \"type instantiation is excessively deep\".\n const markdown: Record<string, unknown> =\n cfg.code.highlighter === 'codeblock'\n ? {\n // Shiki must be off so the `pre` override receives raw source.\n syntaxHighlight: false,\n }\n : {\n shikiConfig: {\n themes: cfg.code.themes,\n defaultColor: false,\n wrap: cfg.code.wrap,\n ...(cfg.code.langs.length ? { langs: cfg.code.langs } : {}),\n },\n };\n\n // Astro does not apply `base` to authored markdown links. MDX inherits these via extendMarkdownConfig.\n markdown.rehypePlugins = [\n [rehypeBaseUrl, { base: config.base }],\n rehypeProseScope,\n rehypeTableColumns,\n ...(cfg.code.highlighter === 'codeblock' ? [rehypeCodeFence] : []),\n ];\n\n updateConfig({\n integrations: added,\n vite: { plugins: vitePlugins as never },\n markdown,\n } as never);\n },\n\n 'astro:config:done'({ injectTypes }) {\n injectTypes({\n filename: 'types.d.ts',\n content: [\n `declare module 'virtual:eqty-docs/config' {`,\n ` const config: import('@eqtylab/docs').DocsConfig & {`,\n ` env: import('@eqtylab/docs').DocsEnv;`,\n ` ownedByConsumer: string[];`,\n ` };`,\n ` export default config;`,\n `}`,\n '',\n ].join('\\n'),\n });\n },\n\n 'astro:routes:resolved'({ routes, logger }) {\n // Catches collisions the filesystem scan cannot see.\n const seen = new Map<string, string>();\n for (const route of routes as Array<{ pattern: string; entrypoint: string }>) {\n const previous = seen.get(route.pattern);\n if (previous && previous !== route.entrypoint) {\n logger.warn(\n `Route ${route.pattern} is claimed twice:\\n ${previous}\\n ${route.entrypoint}\\n` +\n `One of them will be overwritten in the static build.`\n );\n }\n seen.set(route.pattern, route.entrypoint);\n }\n },\n },\n };\n}\n"]}
@@ -0,0 +1 @@
1
+ export declare function assertMdxOnly(contentDir: URL): void;
@@ -0,0 +1,3 @@
1
+ import type { AstroIntegrationLogger } from 'astro';
2
+ import type { Plugin } from 'vite';
3
+ export declare function microlighterGrammarsPlugin(projectRoot: URL, logger: AstroIntegrationLogger): Plugin;
@@ -0,0 +1,2 @@
1
+ import type { AstroIntegration } from 'astro';
2
+ export declare function pagefindIntegration(): AstroIntegration;
@@ -0,0 +1,5 @@
1
+ export declare function rehypeBaseUrl(options: {
2
+ base: string;
3
+ }): (tree: unknown) => void;
4
+ /** Same, for authored HTML strings in frontmatter. */
5
+ export declare function rewriteHtmlBase(html: string, base: string): string;
@@ -0,0 +1,3 @@
1
+ export { rehypeBaseUrl, rewriteHtmlBase } from '../chunk-GSSSQTEV.js';
2
+ //# sourceMappingURL=rehype-base-url.js.map
3
+ //# sourceMappingURL=rehype-base-url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"rehype-base-url.js"}
@@ -0,0 +1 @@
1
+ export declare function rehypeCodeFence(): (tree: unknown) => void;
@@ -0,0 +1 @@
1
+ export declare function rehypeProseScope(): (tree: unknown) => void;
@@ -0,0 +1 @@
1
+ export declare function rehypeTableColumns(): (tree: unknown) => void;
@@ -0,0 +1,7 @@
1
+ export interface ConsumerPages {
2
+ /** Concrete route paths the consumer's pages generate, normalised without trailing slash. */
3
+ ownedPaths: string[];
4
+ /** Route patterns claimed by consumer pages, e.g. '/[...slug]' or '/404'. */
5
+ claimedPatterns: Set<string>;
6
+ }
7
+ export declare function scanConsumerPages(srcDir: URL): ConsumerPages;
@@ -0,0 +1,3 @@
1
+ /** Serves the resolved config to runtime components, which ship from node_modules and cannot reach the consumer's project by path. */
2
+ import type { Plugin } from 'vite';
3
+ export declare function virtualConfigPlugin(getPayload: () => Record<string, unknown>): Plugin;
@@ -0,0 +1,20 @@
1
+ import type { Loader } from 'astro/loaders';
2
+ /** Sentinel id for the content root's own `_group.yaml`; '' is not a valid store key. */
3
+ export declare const ROOT_GROUP_ID = "~root";
4
+ /**
5
+ * MDX only; stray `.md` files fail in `assertMdxOnly`. The `_*` negation is
6
+ * required: the glob loader has no underscore skipping, so `_group.yaml` would become a page.
7
+ */
8
+ export declare function docsLoader(options?: {
9
+ base?: string;
10
+ }): Loader;
11
+ export declare function groupsLoader(options?: {
12
+ base?: string;
13
+ }): Loader;
14
+ /** Both collections, ready to spread. */
15
+ export declare function docsCollections(options?: {
16
+ base?: string;
17
+ }): {
18
+ docs: unknown;
19
+ docsGroups: unknown;
20
+ };