@eqtylab/docs 0.3.3 → 0.3.5
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/README.md +46 -1
- package/dist/index.js +65 -12
- package/dist/index.js.map +1 -1
- package/dist/internal/rehype-relative-links.d.ts +12 -0
- package/dist/runtime/chrome/Header.astro +1 -3
- package/dist/runtime/chrome/Prose.astro +1 -1
- package/dist/runtime/components/CodeFence.astro +1 -1
- package/dist/runtime/layouts/DocsShell.astro +10 -1
- package/dist/runtime/styles/prose.css +9 -2
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -56,6 +56,25 @@ collapsed: false
|
|
|
56
56
|
- A typo in `order` produces a build **warning naming the file and the token** rather than silently
|
|
57
57
|
reordering, and the schema is `.strict()` so an unknown key fails the build.
|
|
58
58
|
|
|
59
|
+
## Linking between pages
|
|
60
|
+
|
|
61
|
+
Write the link the way the file sits on disk and it resolves to that page's URL:
|
|
62
|
+
|
|
63
|
+
```mdx
|
|
64
|
+
See [usage](./usage.mdx) and [the guides index](../guides/index.mdx#ordering).
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
`./usage.mdx` becomes `/getting-started/usage/`, with `base`, `pathPrefix` and the trailing slash
|
|
68
|
+
applied exactly as the sidebar applies them. A `.md` target finds the `.mdx` file of the same name,
|
|
69
|
+
so markdown synced in from a product repo needs no rewriting, and a folder's `index.mdx` resolves to
|
|
70
|
+
the folder. A target that names no page in the content directory is a build **warning naming the
|
|
71
|
+
file and the href** — it still rewrites, so the typo shows up in the log rather than only as a 404.
|
|
72
|
+
|
|
73
|
+
Only content files are rewritten, and only targets that land inside the content directory: a
|
|
74
|
+
relative link out of the collection is someone else's URL to own. Root-relative links are
|
|
75
|
+
base-prefixed instead — Astro does not do that for authored markdown — and extensionless relative
|
|
76
|
+
links are left to the browser.
|
|
77
|
+
|
|
59
78
|
## Three conventions worth knowing
|
|
60
79
|
|
|
61
80
|
**Styling is inline Tailwind, and one `@source` line is what makes it work.** The chrome is styled
|
|
@@ -168,6 +187,32 @@ what a script that rewrites rendered text needs: it has to import `scheduleHighl
|
|
|
168
187
|
highlighting. (`CodeBlock` paints through the CSS Custom Highlight API over `Range`s into those
|
|
169
188
|
very text nodes.) A plain `<script src>` in `public/` cannot import anything.
|
|
170
189
|
|
|
190
|
+
## Owning a page yourself
|
|
191
|
+
|
|
192
|
+
A file in your own `src/pages` wins. The integration sees the route is already claimed, logs that
|
|
193
|
+
it is yielding, and injects nothing there — so a landing page is yours to write, with the same
|
|
194
|
+
chrome every other page gets:
|
|
195
|
+
|
|
196
|
+
```astro
|
|
197
|
+
---
|
|
198
|
+
import Prose from '@eqtylab/docs/chrome/Prose.astro';
|
|
199
|
+
import DocsPage from '@eqtylab/docs/layouts/DocsPage.astro';
|
|
200
|
+
import { docsNav } from '@eqtylab/docs/lib/nav-data.ts';
|
|
201
|
+
|
|
202
|
+
// `nav` is required: the sidebar, the drawer and the 404's suggestions all read it.
|
|
203
|
+
const nav = await docsNav(Astro.url.pathname);
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
<DocsPage title="Home" nav={nav} toc={[]} showToc={false} splash>
|
|
207
|
+
<Prose title="Home">Anything at all.</Prose>
|
|
208
|
+
</DocsPage>
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
`@eqtylab/docs/lib/*` ships the rest of what the injected route uses, with the collection already
|
|
212
|
+
wired in: `docsEntries` and `pathContext` alongside `docsNav` in `nav-data.ts`, `breadcrumbsFor` /
|
|
213
|
+
`prevNextFor` / `buildTocTree` re-exported from there, and `mdxComponents` in `mdx-components.ts`
|
|
214
|
+
for rendering a collection entry through the same component map.
|
|
215
|
+
|
|
171
216
|
## Building the Search Index
|
|
172
217
|
|
|
173
218
|
Full-text search uses the built HTML, via [Pagefind](https://pagefind.app). The integration
|
|
@@ -210,7 +255,7 @@ would 404 in a sub-path build.
|
|
|
210
255
|
|
|
211
256
|
```bash
|
|
212
257
|
pnpm build # guard + node bundle + runtime copy + declarations
|
|
213
|
-
pnpm test # nav ordering, prev/next, breadcrumbs, TOC
|
|
258
|
+
pnpm test # nav ordering, prev/next, breadcrumbs, TOC, prose scope, link resolution
|
|
214
259
|
```
|
|
215
260
|
|
|
216
261
|
`src/*.ts` is bundled for Node (it is loaded when Astro reads your config). `src/runtime/**` ships
|
package/dist/index.js
CHANGED
|
@@ -4,9 +4,10 @@ import { resolveConfig } from './chunk-K7PJRTK3.js';
|
|
|
4
4
|
export { resolveConfig } from './chunk-K7PJRTK3.js';
|
|
5
5
|
import { resolveDocsEnv } from './chunk-ZZ45WAVR.js';
|
|
6
6
|
export { resolveDocsEnv } from './chunk-ZZ45WAVR.js';
|
|
7
|
+
import { docsHref, isExternalHref } from './chunk-VJN3HXKM.js';
|
|
7
8
|
export { badgeSchema, docsSchema, groupSchema } from './chunk-IWKZQ4CW.js';
|
|
9
|
+
import path4 from 'path';
|
|
8
10
|
import { fileURLToPath } from 'url';
|
|
9
|
-
import path3 from 'path';
|
|
10
11
|
import { globSync } from 'tinyglobby';
|
|
11
12
|
import fs, { readdirSync, readFileSync } from 'fs';
|
|
12
13
|
import { createRequire } from 'module';
|
|
@@ -23,7 +24,7 @@ function assertMdxOnly(contentDir) {
|
|
|
23
24
|
if (strays.length === 0) return;
|
|
24
25
|
const list = strays.sort().map((file) => ` - ${file} -> ${file.replace(/\.md$/i, ".mdx")}`).join("\n");
|
|
25
26
|
throw new Error(
|
|
26
|
-
`[@eqtylab/docs] Found ${strays.length} Markdown file${strays.length > 1 ? "s" : ""} in ${
|
|
27
|
+
`[@eqtylab/docs] Found ${strays.length} Markdown file${strays.length > 1 ? "s" : ""} in ${path4.relative(process.cwd(), dir) || dir}:
|
|
27
28
|
${list}
|
|
28
29
|
|
|
29
30
|
Docs content must be .mdx. Only MDX supports the component overrides that render
|
|
@@ -37,7 +38,7 @@ function findGrammarDir(projectRoot) {
|
|
|
37
38
|
const requireFromProject = createRequire(new URL("package.json", projectRoot));
|
|
38
39
|
const equalityEntry = requireFromProject.resolve("@eqtylab/equality");
|
|
39
40
|
const requireFromEquality = createRequire(equalityEntry);
|
|
40
|
-
return
|
|
41
|
+
return path4.resolve(path4.dirname(requireFromEquality.resolve("microlighter")), "grammars");
|
|
41
42
|
}
|
|
42
43
|
function microlighterGrammarsPlugin(projectRoot, logger) {
|
|
43
44
|
return {
|
|
@@ -45,7 +46,7 @@ function microlighterGrammarsPlugin(projectRoot, logger) {
|
|
|
45
46
|
apply: "build",
|
|
46
47
|
generateBundle(_options, bundle) {
|
|
47
48
|
const directories = new Set(
|
|
48
|
-
Object.values(bundle).filter((output) => output.type === "chunk" && output.code.includes(GRAMMAR_IMPORT)).map((output) =>
|
|
49
|
+
Object.values(bundle).filter((output) => output.type === "chunk" && output.code.includes(GRAMMAR_IMPORT)).map((output) => path4.posix.dirname(output.fileName))
|
|
49
50
|
);
|
|
50
51
|
if (directories.size === 0) return;
|
|
51
52
|
let grammarDir;
|
|
@@ -65,7 +66,7 @@ function microlighterGrammarsPlugin(projectRoot, logger) {
|
|
|
65
66
|
this.emitFile({
|
|
66
67
|
type: "asset",
|
|
67
68
|
fileName: directory === "." ? `grammars/${grammar}` : `${directory}/grammars/${grammar}`,
|
|
68
|
-
source: readFileSync(
|
|
69
|
+
source: readFileSync(path4.resolve(grammarDir, grammar), "utf8")
|
|
69
70
|
});
|
|
70
71
|
}
|
|
71
72
|
}
|
|
@@ -96,7 +97,7 @@ function pagefindIntegration() {
|
|
|
96
97
|
name: "@eqtylab/docs/pagefind",
|
|
97
98
|
hooks: {
|
|
98
99
|
"astro:config:setup"({ config, logger }) {
|
|
99
|
-
indexDir =
|
|
100
|
+
indexDir = path4.join(fileURLToPath(config.outDir), INDEX_DIR);
|
|
100
101
|
if (config.output === "server") {
|
|
101
102
|
logger.warn(
|
|
102
103
|
'Output "server" emits no static HTML, so there is nothing for Pagefind to index.'
|
|
@@ -112,9 +113,9 @@ function pagefindIntegration() {
|
|
|
112
113
|
server.middlewares.use((req, res, next) => {
|
|
113
114
|
const requested = indexRequest(req.url, base);
|
|
114
115
|
if (requested === null) return next();
|
|
115
|
-
const file =
|
|
116
|
-
if (!file.startsWith(indexDir +
|
|
117
|
-
res.setHeader("Content-Type", MIME[
|
|
116
|
+
const file = path4.join(indexDir, requested);
|
|
117
|
+
if (!file.startsWith(indexDir + path4.sep) || !fs.existsSync(file)) return next();
|
|
118
|
+
res.setHeader("Content-Type", MIME[path4.extname(file)] ?? "application/octet-stream");
|
|
118
119
|
res.setHeader("Cache-Control", "no-store");
|
|
119
120
|
fs.createReadStream(file).pipe(res);
|
|
120
121
|
});
|
|
@@ -129,7 +130,7 @@ function pagefindIntegration() {
|
|
|
129
130
|
const { page_count, errors: addErrors } = await index.addDirectory({ path: outDir });
|
|
130
131
|
failOn(addErrors, logger, "index the built output");
|
|
131
132
|
const { outputPath, errors: writeErrors } = await index.writeFiles({
|
|
132
|
-
outputPath:
|
|
133
|
+
outputPath: path4.join(outDir, INDEX_DIR)
|
|
133
134
|
});
|
|
134
135
|
failOn(writeErrors, logger, "write the index");
|
|
135
136
|
logger.info(`indexed ${page_count} pages to ${outputPath}`);
|
|
@@ -199,6 +200,43 @@ function rehypeProseScope() {
|
|
|
199
200
|
});
|
|
200
201
|
};
|
|
201
202
|
}
|
|
203
|
+
var CONTENT_EXTENSIONS = [".mdx", ".md"];
|
|
204
|
+
function hasEntry(contentRoot, id) {
|
|
205
|
+
const stem = path4.join(contentRoot, id);
|
|
206
|
+
return CONTENT_EXTENSIONS.some(
|
|
207
|
+
(ext) => fs.existsSync(stem + ext) || fs.existsSync(path4.join(stem, `index${ext}`))
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
function splitTarget(href) {
|
|
211
|
+
if (!href || isExternalHref(href)) return void 0;
|
|
212
|
+
if (href.startsWith("/") || href.startsWith("#") || href.startsWith("?")) return void 0;
|
|
213
|
+
const match = /^([^#?]*)([#?].*)?$/.exec(href);
|
|
214
|
+
const target = match?.[1];
|
|
215
|
+
if (!target || !/\.mdx?$/i.test(target)) return void 0;
|
|
216
|
+
return { target, suffix: match?.[2] ?? "" };
|
|
217
|
+
}
|
|
218
|
+
function rehypeRelativeLinks(options) {
|
|
219
|
+
const { contentRoot, onMissing, ...ctx } = options;
|
|
220
|
+
return function transformer(tree, file) {
|
|
221
|
+
const filePath = file?.path;
|
|
222
|
+
if (!filePath) return;
|
|
223
|
+
const fromRoot = path4.relative(contentRoot, filePath);
|
|
224
|
+
if (!fromRoot || fromRoot.startsWith("..") || path4.isAbsolute(fromRoot)) return;
|
|
225
|
+
visit(tree, "element", (node) => {
|
|
226
|
+
const props = node.properties;
|
|
227
|
+
const href = props?.href;
|
|
228
|
+
if (!props || typeof href !== "string") return;
|
|
229
|
+
const split = splitTarget(href);
|
|
230
|
+
if (!split) return;
|
|
231
|
+
const absolute = path4.resolve(path4.dirname(filePath), split.target);
|
|
232
|
+
const relative = path4.relative(contentRoot, absolute);
|
|
233
|
+
if (!relative || relative.startsWith("..") || path4.isAbsolute(relative)) return;
|
|
234
|
+
const id = relative.split(path4.sep).join("/").replace(/\.mdx?$/i, "").replace(/\/index$/, "");
|
|
235
|
+
if (!hasEntry(contentRoot, id)) onMissing?.(href, filePath);
|
|
236
|
+
props.href = docsHref(id, ctx) + split.suffix;
|
|
237
|
+
});
|
|
238
|
+
};
|
|
239
|
+
}
|
|
202
240
|
function firstRow(table) {
|
|
203
241
|
let found;
|
|
204
242
|
visit(table, "element", (node) => {
|
|
@@ -233,7 +271,7 @@ function rehypeTableColumns() {
|
|
|
233
271
|
var PAGE_EXTENSIONS = ["astro", "md", "mdx", "html", "ts", "js"];
|
|
234
272
|
function toRoutePath(relative) {
|
|
235
273
|
const withoutExt = relative.replace(/\.[^./]+$/, "");
|
|
236
|
-
const segments = withoutExt.split(
|
|
274
|
+
const segments = withoutExt.split(path4.sep).join("/").split("/").filter(Boolean);
|
|
237
275
|
if (segments.at(-1) === "index") segments.pop();
|
|
238
276
|
return "/" + segments.join("/");
|
|
239
277
|
}
|
|
@@ -251,7 +289,7 @@ function scanConsumerPages(srcDir) {
|
|
|
251
289
|
const ownedPaths = [];
|
|
252
290
|
const claimedPatterns = /* @__PURE__ */ new Set();
|
|
253
291
|
for (const file of files) {
|
|
254
|
-
if (file.split(
|
|
292
|
+
if (file.split(path4.sep).some((segment) => segment.startsWith("_"))) continue;
|
|
255
293
|
const routePath = toRoutePath(file);
|
|
256
294
|
claimedPatterns.add(routePath === "" ? "/" : routePath);
|
|
257
295
|
if (!/[[\]]/.test(file)) {
|
|
@@ -374,8 +412,23 @@ function docs(options = {}) {
|
|
|
374
412
|
...cfg.code.langs.length ? { langs: cfg.code.langs } : {}
|
|
375
413
|
}
|
|
376
414
|
};
|
|
415
|
+
markdown.gfm = true;
|
|
416
|
+
markdown.smartypants = true;
|
|
377
417
|
markdown.rehypePlugins = [
|
|
378
418
|
[rehypeBaseUrl, { base: config.base }],
|
|
419
|
+
// Must follow rehypeBaseUrl: the hrefs this emits already carry `base`, and
|
|
420
|
+
// rehypeBaseUrl would prefix them a second time.
|
|
421
|
+
[
|
|
422
|
+
rehypeRelativeLinks,
|
|
423
|
+
{
|
|
424
|
+
contentRoot: fileURLToPath(new URL(`./${cfg.contentDir}/`, config.srcDir)),
|
|
425
|
+
base: config.base,
|
|
426
|
+
pathPrefix: cfg.pathPrefix,
|
|
427
|
+
onMissing: (href, filePath) => logger.warn(
|
|
428
|
+
`${path4.relative(fileURLToPath(config.root), filePath)} links to ${href}, which is not a page in ${cfg.contentDir}`
|
|
429
|
+
)
|
|
430
|
+
}
|
|
431
|
+
],
|
|
379
432
|
rehypeProseScope,
|
|
380
433
|
rehypeTableColumns,
|
|
381
434
|
...cfg.code.highlighter === "codeblock" ? [rehypeCodeFence] : []
|
package/dist/index.js.map
CHANGED
|
@@ -1 +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,GAAiB,aAAA;AAGvB,SAAS,eAAe,WAAA,EAA0B;AAChD,EAAA,MAAM,qBAAqB,aAAA,CAAc,IAAI,GAAA,CAAI,cAAA,EAAgB,WAAW,CAAC,CAAA;AAC7E,EAAA,MAAM,aAAA,GAAgB,kBAAA,CAAmB,OAAA,CAAQ,mBAAmB,CAAA;AACpE,EAAA,MAAM,mBA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7C,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\n/**\n * Structural components that hold the page's own prose rather than content of their own.\n * Without this a heading or list inside a `<TabItem>` would render untypeset.\n */\nconst CONTAINERS = new Set(['Tabs', 'TabItem']);\n\nfunction isContainer(node: Node): boolean {\n return typeof node.name === 'string' && CONTAINERS.has(node.name);\n}\n\nexport function rehypeProseScope() {\n return function transformer(tree: unknown) {\n visit(tree as never, (node: Node) => {\n // A container's children are the page's own markup, so traversal continues into them.\n // The component tag itself is never page markup and never takes the marker.\n if (isComponent(node)) return isContainer(node) ? undefined : 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 { fileURLToPath } from 'node:url';\nimport 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, injectScript, updateConfig, addWatchFile, logger, command } =\n 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 // Resolve against the project root first, or a './...' path means different things\n // in dev and in a build.\n const resolveAsset = (spec: string) =>\n spec.startsWith('.') ? fileURLToPath(new URL(spec, config.root)) : spec;\n\n for (const href of cfg.customCss) {\n injectScript('page-ssr', `import ${JSON.stringify(resolveAsset(href))};`);\n }\n for (const src of cfg.clientScripts) {\n injectScript('page', `import ${JSON.stringify(resolveAsset(src))};`);\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"]}
|
|
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-relative-links.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","fs","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,GAAiB,aAAA;AAGvB,SAAS,eAAe,WAAA,EAA0B;AAChD,EAAA,MAAM,qBAAqB,aAAA,CAAc,IAAI,GAAA,CA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A,SACQ,CAAA;AAAA,MACZ,CAAA;AAAA,MAEA,mBAAA,CAAoB,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\n/**\n * Structural components that hold the page's own prose rather than content of their own.\n * Without this a heading or list inside a `<TabItem>` would render untypeset.\n */\nconst CONTAINERS = new Set(['Tabs', 'TabItem']);\n\nfunction isContainer(node: Node): boolean {\n return typeof node.name === 'string' && CONTAINERS.has(node.name);\n}\n\nexport function rehypeProseScope() {\n return function transformer(tree: unknown) {\n visit(tree as never, (node: Node) => {\n // A container's children are the page's own markup, so traversal continues into them.\n // The component tag itself is never page markup and never takes the marker.\n if (isComponent(node)) return isContainer(node) ? undefined : 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 * Resolves authored relative links between content files - `./usage.mdx`,\n * `../guides/index.md#anchor` - into the public URL of the page they name.\n * Markdown's own convention is a path on disk; the browser needs a route.\n *\n * Only files inside the content root are resolved, and only targets that land\n * inside it: a link out of the collection is someone else's URL to own.\n */\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport { visit } from 'unist-util-visit';\n\nimport { docsHref, isExternalHref, type PathContext } from '../paths.ts';\n\ninterface ElementNode {\n type: string;\n properties?: Record<string, unknown>;\n}\n\ninterface VFile {\n path?: string;\n}\n\nexport interface RelativeLinkOptions extends PathContext {\n /** Absolute path of the docs content directory. */\n contentRoot: string;\n /** Called with the resolved-but-missing target, so a typo fails loudly. */\n onMissing?: (href: string, filePath: string) => void;\n}\n\nconst CONTENT_EXTENSIONS = ['.mdx', '.md'];\n\n/** True once the id names a file Astro will have turned into a page. */\nfunction hasEntry(contentRoot: string, id: string): boolean {\n const stem = path.join(contentRoot, id);\n return CONTENT_EXTENSIONS.some(\n (ext) => fs.existsSync(stem + ext) || fs.existsSync(path.join(stem, `index${ext}`))\n );\n}\n\n/** A content-relative link, split into the file part and any `#hash` / `?query`. */\nfunction splitTarget(href: string): { target: string; suffix: string } | undefined {\n if (!href || isExternalHref(href)) return undefined;\n // Site-absolute, fragment-only and query-only links are already URLs.\n if (href.startsWith('/') || href.startsWith('#') || href.startsWith('?')) return undefined;\n const match = /^([^#?]*)([#?].*)?$/.exec(href);\n const target = match?.[1];\n if (!target || !/\\.mdx?$/i.test(target)) return undefined;\n return { target, suffix: match?.[2] ?? '' };\n}\n\nexport function rehypeRelativeLinks(options: RelativeLinkOptions) {\n const { contentRoot, onMissing, ...ctx } = options;\n\n return function transformer(tree: unknown, file?: VFile) {\n const filePath = file?.path;\n if (!filePath) return;\n\n // Content files only. A page elsewhere in the project has its own notion of \"here\".\n const fromRoot = path.relative(contentRoot, filePath);\n if (!fromRoot || fromRoot.startsWith('..') || path.isAbsolute(fromRoot)) return;\n\n visit(tree as never, 'element', (node: ElementNode) => {\n const props = node.properties;\n const href = props?.href;\n if (!props || typeof href !== 'string') return;\n\n const split = splitTarget(href);\n if (!split) return;\n\n const absolute = path.resolve(path.dirname(filePath), split.target);\n const relative = path.relative(contentRoot, absolute);\n if (!relative || relative.startsWith('..') || path.isAbsolute(relative)) return;\n\n // Astro's ids are extensionless and drop a folder's `index`, except at the root.\n const id = relative\n .split(path.sep)\n .join('/')\n .replace(/\\.mdx?$/i, '')\n .replace(/\\/index$/, '');\n\n if (!hasEntry(contentRoot, id)) onMissing?.(href, filePath);\n\n props.href = docsHref(id, ctx) + split.suffix;\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 path from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport 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 { rehypeRelativeLinks } from './internal/rehype-relative-links.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, injectScript, updateConfig, addWatchFile, logger, command } =\n 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 /*\n Pin the markdown flavour rather than inheriting Astro's defaults. Astro 6.4 stopped defaulting `gfm` and `smartypants` onto `config.markdown`.\n */\n markdown.gfm = true;\n markdown.smartypants = true;\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 // Must follow rehypeBaseUrl: the hrefs this emits already carry `base`, and\n // rehypeBaseUrl would prefix them a second time.\n [\n rehypeRelativeLinks,\n {\n contentRoot: fileURLToPath(new URL(`./${cfg.contentDir}/`, config.srcDir)),\n base: config.base,\n pathPrefix: cfg.pathPrefix,\n onMissing: (href: string, filePath: string) =>\n logger.warn(\n `${path.relative(fileURLToPath(config.root), filePath)} links to ${href}, ` +\n `which is not a page in ${cfg.contentDir}`\n ),\n },\n ],\n rehypeProseScope,\n rehypeTableColumns,\n ...(cfg.code.highlighter === 'codeblock' ? [rehypeCodeFence] : []),\n ];\n\n // Resolve against the project root first, or a './...' path means different things\n // in dev and in a build.\n const resolveAsset = (spec: string) =>\n spec.startsWith('.') ? fileURLToPath(new URL(spec, config.root)) : spec;\n\n for (const href of cfg.customCss) {\n injectScript('page-ssr', `import ${JSON.stringify(resolveAsset(href))};`);\n }\n for (const src of cfg.clientScripts) {\n injectScript('page', `import ${JSON.stringify(resolveAsset(src))};`);\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,12 @@
|
|
|
1
|
+
import { type PathContext } from '../paths.ts';
|
|
2
|
+
interface VFile {
|
|
3
|
+
path?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface RelativeLinkOptions extends PathContext {
|
|
6
|
+
/** Absolute path of the docs content directory. */
|
|
7
|
+
contentRoot: string;
|
|
8
|
+
/** Called with the resolved-but-missing target, so a typo fails loudly. */
|
|
9
|
+
onMissing?: (href: string, filePath: string) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare function rehypeRelativeLinks(options: RelativeLinkOptions): (tree: unknown, file?: VFile) => void;
|
|
12
|
+
export {};
|
|
@@ -51,9 +51,7 @@ const navLink = 'eq-nav-control flex';
|
|
|
51
51
|
alt={CONFIG.logo.alt}
|
|
52
52
|
height="24"
|
|
53
53
|
/>
|
|
54
|
-
) :
|
|
55
|
-
<span class="whitespace-nowrap text-xl font-bold">{CONFIG.title}</span>
|
|
56
|
-
)
|
|
54
|
+
) : null
|
|
57
55
|
}
|
|
58
56
|
<span class="eq-display-gradient whitespace-nowrap text-xl font-bold forced-colors:text-inherit">
|
|
59
57
|
{CONFIG.title}
|
|
@@ -89,7 +89,7 @@ const action =
|
|
|
89
89
|
title sits entirely in the gradient's flat start. */
|
|
90
90
|
}
|
|
91
91
|
<h1
|
|
92
|
-
class="
|
|
92
|
+
class="w-fit text-4xl font-bold text-text-primary"
|
|
93
93
|
data-pagefind-meta="title"
|
|
94
94
|
>
|
|
95
95
|
{title}
|
|
@@ -26,7 +26,7 @@ const language = lang.toLowerCase();
|
|
|
26
26
|
loses to `.code-block` and the sample silently goes back to scrolling at 16rem.
|
|
27
27
|
*/}
|
|
28
28
|
<eq-highlight
|
|
29
|
-
class="mb-4 block [&_[class*=code-block]]:max-h-none!"
|
|
29
|
+
class="mb-4 block font-mono [&_[class*=code-block]]:max-h-none!"
|
|
30
30
|
data-eq-chrome
|
|
31
31
|
data-eq-copy={code}
|
|
32
32
|
>
|
|
@@ -16,6 +16,15 @@ interface Props {
|
|
|
16
16
|
|
|
17
17
|
const { title, description, noIndex, canonical } = Astro.props;
|
|
18
18
|
|
|
19
|
+
/*
|
|
20
|
+
* The `font-sans` class on <body> is load-bearing. Equality declares --font-sans in
|
|
21
|
+
* `@theme inline`, so Tailwind emits it only where something references it, and
|
|
22
|
+
* Equality's preflight sets `font-family: var(--font-sans)` on html. A consumer that
|
|
23
|
+
* never happens to use the utility drops the variable, the preflight resolves to
|
|
24
|
+
* nothing, and every page silently renders in the browser's default serif. Referencing
|
|
25
|
+
* it here is what keeps the design system's typeface applied for every consumer.
|
|
26
|
+
*/
|
|
27
|
+
|
|
19
28
|
const paths = {
|
|
20
29
|
base: import.meta.env.BASE_URL,
|
|
21
30
|
pathPrefix: CONFIG.pathPrefix,
|
|
@@ -86,7 +95,7 @@ const themeBootstrap = `
|
|
|
86
95
|
<script is:inline set:html={themeBootstrap} />
|
|
87
96
|
<slot name="head" />
|
|
88
97
|
</head>
|
|
89
|
-
<body>
|
|
98
|
+
<body class="font-sans">
|
|
90
99
|
<slot />
|
|
91
100
|
</body>
|
|
92
101
|
</html>
|
|
@@ -88,9 +88,16 @@
|
|
|
88
88
|
@apply text-text-primary hover:text-lilac-400 font-medium underline underline-offset-4 transition-all;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
/*
|
|
91
|
+
/*
|
|
92
|
+
Inline code, but never the contents of a highlighted block.
|
|
93
|
+
|
|
94
|
+
`font-mono` is not decoration: Equality's preflight reaches --font-mono through
|
|
95
|
+
`var()`, and that variable is declared `@theme inline`, so Tailwind emits it only
|
|
96
|
+
where a utility references it. The utility inlines the literal stack instead, which
|
|
97
|
+
is what keeps code monospaced in a consumer that uses it nowhere else.
|
|
98
|
+
*/
|
|
92
99
|
:not(pre) > &:is(code) {
|
|
93
|
-
@apply dark:bg-background-overlay bg-greyscale-200 text-text-secondary rounded-sm p-1 text-sm;
|
|
100
|
+
@apply dark:bg-background-overlay bg-greyscale-200 text-text-secondary rounded-sm p-1 font-mono text-sm;
|
|
94
101
|
}
|
|
95
102
|
|
|
96
103
|
/* No table rules: markdown tables render through Equality's Table. */
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eqtylab/docs",
|
|
3
3
|
"description": "Astro documentation framework built on the Equality design system",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.5",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://equality.eqtylab.io/",
|
|
7
7
|
"repository": {
|
|
@@ -62,6 +62,7 @@
|
|
|
62
62
|
"./components/*": "./dist/runtime/components/*",
|
|
63
63
|
"./chrome/*": "./dist/runtime/chrome/*",
|
|
64
64
|
"./layouts/*": "./dist/runtime/layouts/*",
|
|
65
|
+
"./lib/*": "./dist/runtime/lib/*",
|
|
65
66
|
"./routes/*": "./dist/runtime/routes/*",
|
|
66
67
|
"./scripts/*": "./dist/runtime/scripts/*",
|
|
67
68
|
"./styles.css": "./dist/runtime/styles/docs.css",
|