sourcey 3.5.9 → 3.6.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.
- package/README.md +28 -117
- package/dist/adapters/index.d.ts +11 -0
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/index.js +98 -0
- package/dist/adapters/mkdocs.d.ts +5 -0
- package/dist/adapters/mkdocs.d.ts.map +1 -0
- package/dist/adapters/mkdocs.js +367 -0
- package/dist/adapters/shared.d.ts +12 -0
- package/dist/adapters/shared.d.ts.map +1 -0
- package/dist/adapters/shared.js +134 -0
- package/dist/adapters/types.d.ts +68 -0
- package/dist/adapters/types.d.ts.map +1 -0
- package/dist/adapters/types.js +1 -0
- package/dist/client/search.js +77 -8
- package/dist/client/sidebar.js +169 -0
- package/dist/components/layout/Head.js +16 -3
- package/dist/components/layout/Sidebar.d.ts.map +1 -1
- package/dist/components/layout/Sidebar.js +1 -1
- package/dist/components/layout/TableOfContents.d.ts.map +1 -1
- package/dist/components/layout/TableOfContents.js +4 -2
- package/dist/config.d.ts +38 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +79 -141
- package/dist/core/doxygen-loader.d.ts.map +1 -1
- package/dist/core/doxygen-loader.js +2 -0
- package/dist/core/markdown-loader.d.ts +14 -0
- package/dist/core/markdown-loader.d.ts.map +1 -1
- package/dist/core/markdown-loader.js +63 -22
- package/dist/core/navigation.d.ts.map +1 -1
- package/dist/core/navigation.js +8 -7
- package/dist/core/search-indexer.d.ts +10 -0
- package/dist/core/search-indexer.d.ts.map +1 -1
- package/dist/core/search-indexer.js +5 -0
- package/dist/dev-server.d.ts.map +1 -1
- package/dist/dev-server.js +60 -33
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +19 -14
- package/dist/site-assembly.d.ts.map +1 -1
- package/dist/site-assembly.js +107 -25
- package/dist/utils/markdown.d.ts.map +1 -1
- package/dist/utils/markdown.js +15 -4
- package/dist/vite-plugin.d.ts +2 -0
- package/dist/vite-plugin.d.ts.map +1 -1
- package/dist/vite-plugin.js +71 -1
- package/package.json +4 -3
package/dist/config.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { access
|
|
2
|
-
import { resolve,
|
|
1
|
+
import { access } from "node:fs/promises";
|
|
2
|
+
import { resolve, dirname } from "node:path";
|
|
3
3
|
import { createJiti } from "jiti";
|
|
4
4
|
import { normalizeBaseUrl, normalizeSiteUrl } from "./site-url.js";
|
|
5
|
+
import { doxygen as doxygenSource, godoc as godocSource, markdown as markdownSource, mcp as mcpSource, mkdocs as mkdocsSource, openapi as openapiSource, } from "./adapters/index.js";
|
|
5
6
|
export function defineConfig(config) {
|
|
6
7
|
return config;
|
|
7
8
|
}
|
|
@@ -40,7 +41,7 @@ export async function loadConfig(configOrDir) {
|
|
|
40
41
|
` export default defineConfig({ navigation: { tabs: [...] } });\n`);
|
|
41
42
|
}
|
|
42
43
|
const jiti = createJiti(import.meta.url);
|
|
43
|
-
const mod = await jiti.import(configPath);
|
|
44
|
+
const mod = (await jiti.import(configPath));
|
|
44
45
|
const raw = mod.default;
|
|
45
46
|
if (!raw?.navigation?.tabs) {
|
|
46
47
|
throw new Error("sourcey.config.ts must export default defineConfig({ navigation: { tabs: [...] } })");
|
|
@@ -60,12 +61,23 @@ export function configFromSpec(specPath) {
|
|
|
60
61
|
theme: {
|
|
61
62
|
preset: "default",
|
|
62
63
|
colors: { ...DEFAULT_COLORS },
|
|
63
|
-
fonts: {
|
|
64
|
+
fonts: {
|
|
65
|
+
sans: `'${DEFAULT_FONT_SANS}', ${SYSTEM_SANS}`,
|
|
66
|
+
mono: SYSTEM_MONO,
|
|
67
|
+
googleFont: DEFAULT_FONT_SANS,
|
|
68
|
+
},
|
|
64
69
|
layout: { ...DEFAULT_LAYOUT },
|
|
65
70
|
css: [],
|
|
66
71
|
},
|
|
67
72
|
codeSamples: ["curl", "javascript", "python"],
|
|
68
|
-
tabs: [
|
|
73
|
+
tabs: [
|
|
74
|
+
{
|
|
75
|
+
label: "API Reference",
|
|
76
|
+
slug: "api",
|
|
77
|
+
source: { kind: "openapi", spec: absSpec, watchPaths: [absSpec] },
|
|
78
|
+
openapi: absSpec,
|
|
79
|
+
},
|
|
80
|
+
],
|
|
69
81
|
navbar: { links: [] },
|
|
70
82
|
footer: { links: [] },
|
|
71
83
|
changelog: { enabled: true, feed: false, permalinks: false, ogImages: false },
|
|
@@ -87,8 +99,12 @@ export async function resolveConfigFromRaw(raw, configDir) {
|
|
|
87
99
|
prettyUrls: resolvePrettyUrls(raw.prettyUrls),
|
|
88
100
|
theme,
|
|
89
101
|
logo,
|
|
90
|
-
favicon: raw.favicon && !raw.favicon.startsWith("http") && !raw.favicon.startsWith("data:")
|
|
91
|
-
|
|
102
|
+
favicon: raw.favicon && !raw.favicon.startsWith("http") && !raw.favicon.startsWith("data:")
|
|
103
|
+
? resolve(configDir, raw.favicon)
|
|
104
|
+
: raw.favicon,
|
|
105
|
+
ogImage: raw.ogImage && !raw.ogImage.startsWith("http") && !raw.ogImage.startsWith("data:")
|
|
106
|
+
? resolve(configDir, raw.ogImage)
|
|
107
|
+
: raw.ogImage,
|
|
92
108
|
repo: raw.repo,
|
|
93
109
|
editBranch: raw.editBranch,
|
|
94
110
|
editBasePath: raw.editBasePath,
|
|
@@ -136,7 +152,7 @@ function resolveTheme(raw, configDir) {
|
|
|
136
152
|
toc: raw.theme?.layout?.toc ?? DEFAULT_LAYOUT.toc,
|
|
137
153
|
content: raw.theme?.layout?.content ?? DEFAULT_LAYOUT.content,
|
|
138
154
|
};
|
|
139
|
-
const css = (raw.theme?.css ?? []).map(p => resolve(configDir, p));
|
|
155
|
+
const css = (raw.theme?.css ?? []).map((p) => resolve(configDir, p));
|
|
140
156
|
return { preset, colors, fonts, layout, css };
|
|
141
157
|
}
|
|
142
158
|
function resolveLogo(logo, configDir) {
|
|
@@ -163,154 +179,79 @@ async function resolveTabs(tabs, configDir) {
|
|
|
163
179
|
const resolved = [];
|
|
164
180
|
for (const tab of tabs) {
|
|
165
181
|
if (!tab.tab)
|
|
166
|
-
throw new Error(
|
|
182
|
+
throw new Error('Tab missing "tab" name');
|
|
167
183
|
const slug = tab.slug !== undefined ? tab.slug : slugify(tab.tab);
|
|
168
184
|
if (slugs.has(slug))
|
|
169
185
|
throw new Error(`Duplicate tab slug "${slug}" (from "${tab.tab}")`);
|
|
170
186
|
slugs.add(slug);
|
|
171
|
-
const sources = [
|
|
187
|
+
const sources = [
|
|
188
|
+
tab.source,
|
|
189
|
+
tab.openapi,
|
|
190
|
+
tab.mkdocs,
|
|
191
|
+
tab.groups,
|
|
192
|
+
tab.doxygen,
|
|
193
|
+
tab.mcp,
|
|
194
|
+
tab.godoc,
|
|
195
|
+
].filter(Boolean).length;
|
|
172
196
|
if (sources > 1) {
|
|
173
|
-
throw new Error(`Tab "${tab.tab}" has multiple sources; use only one of "openapi", "groups", "doxygen", "mcp", or "godoc"`);
|
|
197
|
+
throw new Error(`Tab "${tab.tab}" has multiple sources; use only one of "source", "openapi", "mkdocs", "groups", "doxygen", "mcp", or "godoc"`);
|
|
174
198
|
}
|
|
175
199
|
if (sources === 0) {
|
|
176
|
-
throw new Error(`Tab "${tab.tab}" needs one of "openapi", "groups", "doxygen", "mcp", or "godoc"`);
|
|
177
|
-
}
|
|
178
|
-
if (tab.openapi) {
|
|
179
|
-
if (isUrl(tab.openapi)) {
|
|
180
|
-
resolved.push({ label: tab.tab, slug, openapi: tab.openapi });
|
|
181
|
-
}
|
|
182
|
-
else {
|
|
183
|
-
const absPath = resolve(configDir, tab.openapi);
|
|
184
|
-
await assertExists(absPath, `OpenAPI spec "${tab.openapi}" in tab "${tab.tab}"`);
|
|
185
|
-
resolved.push({ label: tab.tab, slug, openapi: absPath });
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
else if (tab.mcp) {
|
|
189
|
-
if (isUrl(tab.mcp)) {
|
|
190
|
-
resolved.push({ label: tab.tab, slug, mcp: tab.mcp });
|
|
191
|
-
}
|
|
192
|
-
else {
|
|
193
|
-
const absPath = resolve(configDir, tab.mcp);
|
|
194
|
-
await assertExists(absPath, `MCP spec "${tab.mcp}" in tab "${tab.tab}"`);
|
|
195
|
-
resolved.push({ label: tab.tab, slug, mcp: absPath });
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
else if (tab.doxygen) {
|
|
199
|
-
const absXml = resolve(configDir, tab.doxygen.xml);
|
|
200
|
-
await assertExists(absXml, `Doxygen XML directory "${tab.doxygen.xml}" in tab "${tab.tab}"`);
|
|
201
|
-
resolved.push({
|
|
202
|
-
label: tab.tab,
|
|
203
|
-
slug,
|
|
204
|
-
doxygen: {
|
|
205
|
-
xml: absXml,
|
|
206
|
-
language: tab.doxygen.language ?? "cpp",
|
|
207
|
-
groups: tab.doxygen.groups ?? false,
|
|
208
|
-
index: tab.doxygen.index === false ? "none" : (tab.doxygen.index ?? "auto"),
|
|
209
|
-
},
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
else if (tab.godoc) {
|
|
213
|
-
const cfg = typeof tab.godoc === "string" ? { module: tab.godoc } : tab.godoc;
|
|
214
|
-
const moduleAbs = resolve(configDir, cfg.module ?? ".");
|
|
215
|
-
await assertExists(moduleAbs, `Go module directory "${cfg.module ?? "."}" in tab "${tab.tab}"`);
|
|
216
|
-
const snapshotAbs = cfg.snapshot ? resolve(configDir, cfg.snapshot) : undefined;
|
|
217
|
-
resolved.push({
|
|
218
|
-
label: tab.tab,
|
|
219
|
-
slug,
|
|
220
|
-
godoc: {
|
|
221
|
-
module: moduleAbs,
|
|
222
|
-
packages: cfg.packages?.length ? cfg.packages : ["./..."],
|
|
223
|
-
snapshot: snapshotAbs,
|
|
224
|
-
mode: cfg.mode ?? "auto",
|
|
225
|
-
includeTests: cfg.includeTests ?? true,
|
|
226
|
-
includeUnexported: cfg.includeUnexported ?? false,
|
|
227
|
-
hideUndocumented: cfg.hideUndocumented ?? false,
|
|
228
|
-
exclude: cfg.exclude ?? [],
|
|
229
|
-
goEnv: cfg.goEnv,
|
|
230
|
-
sourceBasePath: trimSlashes(cfg.sourceBasePath ?? ""),
|
|
231
|
-
},
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
else {
|
|
235
|
-
const groups = await resolveGroups(tab.groups, tab.tab, configDir);
|
|
236
|
-
resolved.push({ label: tab.tab, slug, groups });
|
|
200
|
+
throw new Error(`Tab "${tab.tab}" needs one of "source", "openapi", "mkdocs", "groups", "doxygen", "mcp", or "godoc"`);
|
|
237
201
|
}
|
|
202
|
+
const adapter = tab.source ?? legacySourceAdapter(tab);
|
|
203
|
+
const source = await adapter.resolve({
|
|
204
|
+
configDir,
|
|
205
|
+
tabName: tab.tab,
|
|
206
|
+
tabSlug: slug,
|
|
207
|
+
resolvePath: (path) => resolve(configDir, path),
|
|
208
|
+
assertExists,
|
|
209
|
+
isUrl,
|
|
210
|
+
});
|
|
211
|
+
resolved.push(resolvedTabFromSource(tab.tab, slug, source));
|
|
238
212
|
}
|
|
239
213
|
return resolved;
|
|
240
214
|
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
const rel = relative(configDir, file).replace(/\.[^.]+$/, "");
|
|
254
|
-
pages.push({ slug: rel, file });
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
else {
|
|
258
|
-
const absPath = await resolvePagePath(pageSlug, configDir);
|
|
259
|
-
pages.push({ slug: pageSlug, file: absPath });
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
resolved.push({ label: group.group, pages });
|
|
263
|
-
}
|
|
264
|
-
return resolved;
|
|
215
|
+
function legacySourceAdapter(tab) {
|
|
216
|
+
if (tab.openapi)
|
|
217
|
+
return openapiSource(tab.openapi);
|
|
218
|
+
if (tab.mkdocs)
|
|
219
|
+
return mkdocsSource(tab.mkdocs);
|
|
220
|
+
if (tab.mcp)
|
|
221
|
+
return mcpSource(tab.mcp);
|
|
222
|
+
if (tab.doxygen)
|
|
223
|
+
return doxygenSource(tab.doxygen);
|
|
224
|
+
if (tab.godoc)
|
|
225
|
+
return godocSource(tab.godoc);
|
|
226
|
+
return markdownSource({ groups: tab.groups });
|
|
265
227
|
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
return
|
|
283
|
-
})
|
|
284
|
-
.sort()
|
|
285
|
-
.map((f) => resolve(dir, f));
|
|
286
|
-
if (!matches.length) {
|
|
287
|
-
throw new Error(`Glob "${pattern}" matched no files in ${dir}`);
|
|
288
|
-
}
|
|
289
|
-
return matches;
|
|
290
|
-
}
|
|
291
|
-
catch (err) {
|
|
292
|
-
if (err.code === "ENOENT") {
|
|
293
|
-
throw new Error(`Glob directory not found: ${dir}`);
|
|
294
|
-
}
|
|
295
|
-
throw err;
|
|
228
|
+
function resolvedTabFromSource(label, slug, source) {
|
|
229
|
+
const base = { label, slug, source };
|
|
230
|
+
switch (source.kind) {
|
|
231
|
+
case "openapi":
|
|
232
|
+
return { ...base, openapi: source.spec };
|
|
233
|
+
case "mcp":
|
|
234
|
+
return { ...base, mcp: source.spec };
|
|
235
|
+
case "markdown":
|
|
236
|
+
return {
|
|
237
|
+
...base,
|
|
238
|
+
mkdocs: source.adapter === "mkdocs" ? source.configPath : undefined,
|
|
239
|
+
groups: source.groups,
|
|
240
|
+
};
|
|
241
|
+
case "doxygen":
|
|
242
|
+
return { ...base, doxygen: source.config };
|
|
243
|
+
case "godoc":
|
|
244
|
+
return { ...base, godoc: source.config };
|
|
296
245
|
}
|
|
297
246
|
}
|
|
298
|
-
async function resolvePagePath(slug, configDir) {
|
|
299
|
-
for (const ext of [".md", ".mdx"]) {
|
|
300
|
-
const candidate = resolve(configDir, `${slug}${ext}`);
|
|
301
|
-
try {
|
|
302
|
-
await access(candidate);
|
|
303
|
-
return candidate;
|
|
304
|
-
}
|
|
305
|
-
catch { /* try next */ }
|
|
306
|
-
}
|
|
307
|
-
throw new Error(`Page "${slug}" not found (tried ${slug}.md, ${slug}.mdx in ${configDir})`);
|
|
308
|
-
}
|
|
309
247
|
// ---------------------------------------------------------------------------
|
|
310
248
|
// Utilities
|
|
311
249
|
// ---------------------------------------------------------------------------
|
|
312
250
|
export function slugify(name) {
|
|
313
|
-
return name
|
|
251
|
+
return name
|
|
252
|
+
.toLowerCase()
|
|
253
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
254
|
+
.replace(/^-|-$/g, "");
|
|
314
255
|
}
|
|
315
256
|
/** Build a path under a tab, handling empty slugs (root-level tabs). */
|
|
316
257
|
export function tabPath(tabSlug, file) {
|
|
@@ -358,9 +299,6 @@ export function hexToRgb(hex) {
|
|
|
358
299
|
const b = parseInt(h.slice(4, 6), 16);
|
|
359
300
|
return `${r} ${g} ${b}`;
|
|
360
301
|
}
|
|
361
|
-
function trimSlashes(path) {
|
|
362
|
-
return path.replace(/^\/+|\/+$/g, "");
|
|
363
|
-
}
|
|
364
302
|
async function assertExists(filePath, label) {
|
|
365
303
|
try {
|
|
366
304
|
await access(filePath);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doxygen-loader.d.ts","sourceRoot":"","sources":["../../src/core/doxygen-loader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAqB,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAE7E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,OAAO,EAA6B,MAAM,iBAAiB,CAAC;AAM1E,MAAM,WAAW,aAAa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G,MAAM,CAShE;AAED,wBAAgB,gCAAgC,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAcrE;AAED,wBAAsB,cAAc,CAClC,MAAM,EAAE,qBAAqB,EAC7B,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,aAAa,CAAC,CAoGxB"}
|
|
@@ -59,6 +59,7 @@ export async function loadDoxygenTab(config, tabSlug, tabLabel) {
|
|
|
59
59
|
const generated = await generate({
|
|
60
60
|
directory: config.xml,
|
|
61
61
|
language: config.language,
|
|
62
|
+
sourceUrl: config.sourceUrl,
|
|
62
63
|
quiet: true,
|
|
63
64
|
});
|
|
64
65
|
const pages = new Map();
|
|
@@ -79,6 +80,7 @@ export async function loadDoxygenTab(config, tabSlug, tabLabel) {
|
|
|
79
80
|
headings,
|
|
80
81
|
sourcePath: `api/${page.slug}.md`,
|
|
81
82
|
editPath: page.kind === "group" ? `api/${page.slug}.md` : null,
|
|
83
|
+
searchEntries: page.searchEntries,
|
|
82
84
|
});
|
|
83
85
|
// Group by the last segment of namespace (e.g. "icy::http" -> "http")
|
|
84
86
|
const groupKey = page.module ?? lastSegment(page.namespace) ?? "API";
|
|
@@ -20,12 +20,19 @@ export interface MarkdownPage {
|
|
|
20
20
|
editBasePath?: string | null;
|
|
21
21
|
/** Optional page-local entries that should be indexed in addition to headings. */
|
|
22
22
|
searchEntries?: PageSearchEntry[];
|
|
23
|
+
/** Optional source root used to rewrite source-format-relative assets. */
|
|
24
|
+
sourceRoot?: string;
|
|
23
25
|
}
|
|
24
26
|
export interface PageSearchEntry {
|
|
25
27
|
title: string;
|
|
26
28
|
content: string;
|
|
27
29
|
anchor?: string;
|
|
28
30
|
category: string;
|
|
31
|
+
symbolKind?: string;
|
|
32
|
+
owner?: string;
|
|
33
|
+
ownerKind?: string;
|
|
34
|
+
namespace?: string;
|
|
35
|
+
qualifiedName?: string;
|
|
29
36
|
}
|
|
30
37
|
export interface ChangelogPage {
|
|
31
38
|
kind: "changelog";
|
|
@@ -45,7 +52,14 @@ export type { PageHeading } from "../utils/markdown.js";
|
|
|
45
52
|
export interface LoadDocsPageOptions {
|
|
46
53
|
changelog?: boolean;
|
|
47
54
|
repoUrl?: string;
|
|
55
|
+
sourceRoot?: string;
|
|
56
|
+
preprocess?: MarkdownPreprocessor[];
|
|
48
57
|
}
|
|
58
|
+
export interface MarkdownPreprocessContext {
|
|
59
|
+
filePath: string;
|
|
60
|
+
sourceRoot?: string;
|
|
61
|
+
}
|
|
62
|
+
export type MarkdownPreprocessor = (body: string, context: MarkdownPreprocessContext) => string;
|
|
49
63
|
/**
|
|
50
64
|
* Load a single markdown file and return a MarkdownPage.
|
|
51
65
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-loader.d.ts","sourceRoot":"","sources":["../../src/core/markdown-loader.ts"],"names":[],"mappings":"AAMA,OAAO,
|
|
1
|
+
{"version":3,"file":"markdown-loader.d.ts","sourceRoot":"","sources":["../../src/core/markdown-loader.ts"],"names":[],"mappings":"AAMA,OAAO,EAOL,KAAK,WAAW,EACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAMtD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,UAAU,CAAC;IACjB,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,WAAW,EAAE,MAAM,CAAC;IACpB,qDAAqD;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,qDAAqD;IACrD,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,sEAAsE;IACtE,UAAU,EAAE,MAAM,CAAC;IACnB,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,8FAA8F;IAC9F,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,kFAAkF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oB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,yBAAyB,KAAK,MAAM,CAAC;AAknChG;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAK5F;AAED,wBAAsB,YAAY,CAChC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,QAAQ,CAAC,CAgCnB;AA+DD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAOrD"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { readFile } from "node:fs/promises";
|
|
1
|
+
import { readFile as readFileAsync } from "node:fs/promises";
|
|
2
2
|
import { basename, extname, relative } from "node:path";
|
|
3
3
|
import { load as parseYaml } from "js-yaml";
|
|
4
4
|
import { normalizeChangelog } from "./changelog-normalizer.js";
|
|
5
5
|
import { htmlId } from "../utils/html-id.js";
|
|
6
6
|
import { renderIcon } from "../utils/icons.js";
|
|
7
|
-
import { renderCodeBlock, renderMarkdown, renderMarkdownInline, extractHeadings, } from "../utils/markdown.js";
|
|
7
|
+
import { renderCodeBlock, renderMarkdown, renderMarkdownInline, extractHeadings, extractFirstParagraph, stripMarkdownLinks, } from "../utils/markdown.js";
|
|
8
8
|
// ---------------------------------------------------------------------------
|
|
9
9
|
// Frontmatter parsing
|
|
10
10
|
// ---------------------------------------------------------------------------
|
|
@@ -502,7 +502,10 @@ ${body}
|
|
|
502
502
|
return null;
|
|
503
503
|
return `\n\n${buildTabbedHtml(codeBlocks, nextId("cg"), "directive-code-group")}\n`;
|
|
504
504
|
}
|
|
505
|
-
if (node.name === "Note" ||
|
|
505
|
+
if (node.name === "Note" ||
|
|
506
|
+
node.name === "Warning" ||
|
|
507
|
+
node.name === "Tip" ||
|
|
508
|
+
node.name === "Info") {
|
|
506
509
|
const type = node.name.toLowerCase();
|
|
507
510
|
const label = renderMarkdownInline(node.attrs.title?.trim() || node.name.charAt(0).toUpperCase() + node.name.slice(1)).trim();
|
|
508
511
|
const body = renderComponentChildrenToHtml(node.children);
|
|
@@ -562,10 +565,7 @@ function escapeRegExp(value) {
|
|
|
562
565
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
563
566
|
}
|
|
564
567
|
function escapeHtmlAttr(value) {
|
|
565
|
-
return value
|
|
566
|
-
.replace(/&/g, "&")
|
|
567
|
-
.replace(/"/g, """)
|
|
568
|
-
.replace(/</g, "<");
|
|
568
|
+
return value.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<");
|
|
569
569
|
}
|
|
570
570
|
function stripDirectiveIndent(line) {
|
|
571
571
|
return line.replace(/^ {0,3}/, "");
|
|
@@ -585,9 +585,7 @@ function closesFence(line, fence) {
|
|
|
585
585
|
}
|
|
586
586
|
/** Build tabbed UI HTML (shared by :::tabs and :::code-group). */
|
|
587
587
|
function buildTabbedHtml(tabs, id, extraClass) {
|
|
588
|
-
const cls = extraClass
|
|
589
|
-
? `directive-tabs ${extraClass} not-prose`
|
|
590
|
-
: "directive-tabs not-prose";
|
|
588
|
+
const cls = extraClass ? `directive-tabs ${extraClass} not-prose` : "directive-tabs not-prose";
|
|
591
589
|
const buttons = tabs
|
|
592
590
|
.map((t, i) => `<button class="directive-tab${i === 0 ? " active" : ""}" data-tab-group="${id}" data-tab-index="${i}">${t.title}</button>`)
|
|
593
591
|
.join("\n");
|
|
@@ -652,7 +650,10 @@ function splitChildren(content, marker) {
|
|
|
652
650
|
}
|
|
653
651
|
children.push({
|
|
654
652
|
attrs: parseAttrs(start[1] ?? ""),
|
|
655
|
-
body: lines
|
|
653
|
+
body: lines
|
|
654
|
+
.slice(i + 1, j)
|
|
655
|
+
.join("\n")
|
|
656
|
+
.trim(),
|
|
656
657
|
});
|
|
657
658
|
i = j + 1;
|
|
658
659
|
}
|
|
@@ -696,7 +697,9 @@ const SUPPORTED_DIRECTIVES = new Set([
|
|
|
696
697
|
"accordion",
|
|
697
698
|
]);
|
|
698
699
|
function matchDirectiveStart(line) {
|
|
699
|
-
const match = stripDirectiveIndent(line)
|
|
700
|
+
const match = stripDirectiveIndent(line)
|
|
701
|
+
.trimEnd()
|
|
702
|
+
.match(/^:::(\w[\w-]*)(.*)$/);
|
|
700
703
|
if (!match || !SUPPORTED_DIRECTIVES.has(match[1]))
|
|
701
704
|
return null;
|
|
702
705
|
return {
|
|
@@ -927,12 +930,12 @@ function preprocessDirectives(body) {
|
|
|
927
930
|
* Load a single markdown file and return a MarkdownPage.
|
|
928
931
|
*/
|
|
929
932
|
export async function loadMarkdownPage(filePath, slug) {
|
|
930
|
-
const raw = await
|
|
933
|
+
const raw = await readFileAsync(filePath, "utf-8");
|
|
931
934
|
const { meta, body } = parseFrontmatter(raw);
|
|
932
935
|
return loadMarkdownPageFromBody(filePath, slug, body, meta);
|
|
933
936
|
}
|
|
934
937
|
export async function loadDocsPage(filePath, slug, options = {}) {
|
|
935
|
-
const raw = await
|
|
938
|
+
const raw = await readFileAsync(filePath, "utf-8");
|
|
936
939
|
const { meta, body } = parseFrontmatter(raw);
|
|
937
940
|
if (shouldTreatAsChangelog(filePath, meta, options)) {
|
|
938
941
|
const sourcePath = relative(process.cwd(), filePath);
|
|
@@ -941,9 +944,7 @@ export async function loadDocsPage(filePath, slug, options = {}) {
|
|
|
941
944
|
description: typeof meta.description === "string" ? meta.description : undefined,
|
|
942
945
|
repoUrl: options.repoUrl,
|
|
943
946
|
});
|
|
944
|
-
const description = typeof meta.description === "string"
|
|
945
|
-
? meta.description
|
|
946
|
-
: changelog.description ?? "";
|
|
947
|
+
const description = typeof meta.description === "string" ? meta.description : (changelog.description ?? "");
|
|
947
948
|
return {
|
|
948
949
|
kind: "changelog",
|
|
949
950
|
title: changelog.title,
|
|
@@ -960,7 +961,7 @@ export async function loadDocsPage(filePath, slug, options = {}) {
|
|
|
960
961
|
rawBody: body,
|
|
961
962
|
};
|
|
962
963
|
}
|
|
963
|
-
return loadMarkdownPageFromBody(filePath, slug, body, meta);
|
|
964
|
+
return loadMarkdownPageFromBody(filePath, slug, body, meta, options);
|
|
964
965
|
}
|
|
965
966
|
function shouldTreatAsChangelog(filePath, meta, options) {
|
|
966
967
|
if (options.changelog === false)
|
|
@@ -969,14 +970,15 @@ function shouldTreatAsChangelog(filePath, meta, options) {
|
|
|
969
970
|
return true;
|
|
970
971
|
return basename(filePath).toLowerCase() === "changelog.md";
|
|
971
972
|
}
|
|
972
|
-
function loadMarkdownPageFromBody(filePath, slug, body, meta) {
|
|
973
|
+
function loadMarkdownPageFromBody(filePath, slug, body, meta, options = {}) {
|
|
973
974
|
resetDirectiveCounter();
|
|
974
|
-
const
|
|
975
|
+
const sourcePreprocessed = preprocessSourceMarkdown(body, filePath, options);
|
|
976
|
+
const componentPreprocessed = preprocessComponents(sourcePreprocessed);
|
|
975
977
|
const preprocessed = preprocessDirectives(componentPreprocessed);
|
|
976
978
|
const headings = extractHeadings(componentPreprocessed);
|
|
977
979
|
const html = renderMarkdown(preprocessed);
|
|
978
980
|
const title = meta.title ?? extractFirstHeading(componentPreprocessed) ?? slug;
|
|
979
|
-
const description = meta.description
|
|
981
|
+
const description = normalizeMarkdownDescription(meta.description, componentPreprocessed);
|
|
980
982
|
// Strip leading h1 from rendered HTML when it duplicates the page title
|
|
981
983
|
const cleanHtml = html.replace(/^\s*<h1[^>]*>(.*?)<\/h1>\s*/i, (_m, inner) => inner.replace(/<[^>]+>/g, "").trim() === title ? "" : _m);
|
|
982
984
|
const sourcePath = relative(process.cwd(), filePath);
|
|
@@ -989,8 +991,15 @@ function loadMarkdownPageFromBody(filePath, slug, body, meta) {
|
|
|
989
991
|
headings,
|
|
990
992
|
sourcePath,
|
|
991
993
|
editPath: sourcePath,
|
|
994
|
+
sourceRoot: options.sourceRoot ? relative(process.cwd(), options.sourceRoot) : undefined,
|
|
992
995
|
};
|
|
993
996
|
}
|
|
997
|
+
function normalizeMarkdownDescription(description, markdown) {
|
|
998
|
+
if (typeof description === "string" && description.trim()) {
|
|
999
|
+
return description;
|
|
1000
|
+
}
|
|
1001
|
+
return stripMarkdownLinks(extractFirstParagraph(markdown)).replace(/\s+/g, " ").trim();
|
|
1002
|
+
}
|
|
994
1003
|
/**
|
|
995
1004
|
* Extract the first # heading from markdown as a fallback title.
|
|
996
1005
|
*/
|
|
@@ -1008,5 +1017,37 @@ function extractFirstHeading(md) {
|
|
|
1008
1017
|
export function slugFromPath(filePath) {
|
|
1009
1018
|
const ext = extname(filePath);
|
|
1010
1019
|
const stripped = ext ? filePath.slice(0, -ext.length) : filePath;
|
|
1011
|
-
return stripped
|
|
1020
|
+
return stripped
|
|
1021
|
+
.split("/")
|
|
1022
|
+
.map((s) => slugSegmentFromPath(s))
|
|
1023
|
+
.join("/");
|
|
1024
|
+
}
|
|
1025
|
+
function slugSegmentFromPath(segment) {
|
|
1026
|
+
const normalized = segment
|
|
1027
|
+
.replace(/^operator=$/, "operator-assign")
|
|
1028
|
+
.replace(/^~(.+)$/, "destructor-$1")
|
|
1029
|
+
.replace(/<=>/g, "-spaceship")
|
|
1030
|
+
.replace(/<=/g, "-le")
|
|
1031
|
+
.replace(/>=/g, "-ge")
|
|
1032
|
+
.replace(/==/g, "-eq")
|
|
1033
|
+
.replace(/!=/g, "-ne")
|
|
1034
|
+
.replace(/\[\]/g, "-array")
|
|
1035
|
+
.replace(/\+=/g, "-plus-eq")
|
|
1036
|
+
.replace(/\/=/g, "-slash-eq")
|
|
1037
|
+
.replace(/\//g, "-slash")
|
|
1038
|
+
.replace(/=/g, "-eq")
|
|
1039
|
+
.replace(/\+/g, "-plus")
|
|
1040
|
+
.replace(/</g, "-lt")
|
|
1041
|
+
.replace(/>/g, "-gt");
|
|
1042
|
+
return htmlId(normalized);
|
|
1043
|
+
}
|
|
1044
|
+
function preprocessSourceMarkdown(body, filePath, options) {
|
|
1045
|
+
let current = body;
|
|
1046
|
+
for (const preprocess of options.preprocess ?? []) {
|
|
1047
|
+
current = preprocess(current, {
|
|
1048
|
+
filePath,
|
|
1049
|
+
sourceRoot: options.sourceRoot,
|
|
1050
|
+
});
|
|
1051
|
+
}
|
|
1052
|
+
return current;
|
|
1012
1053
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/core/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAGjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAgB/D,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,OAAO,EAAE,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,6DAA6D;IAC7D,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,MAAM,EAAE,YAAY,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,WAAW,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,IAAI,EAAE,MAAM,CAAC;IACb,0CAA0C;IAC1C,EAAE,EAAE,MAAM,CAAC;IACX,kEAAkE;IAClE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAMD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,cAAc,EACpB,OAAO,EAAE,MAAM,EACf,UAAU,GAAE,U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AC7B,OAAO,CAiDT;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,WAAW,EAChB,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,EAClC,UAAU,GAAE,UAAkB,GAC7B,OAAO,CA8BT;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,cAAc,CASnE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,GAAG,EAAE,cAAc,EACnB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACf,cAAc,CAEhB"}
|
package/dist/core/navigation.js
CHANGED
|
@@ -73,31 +73,32 @@ export function buildNavFromSpec(spec, tabSlug, prettyUrls = false) {
|
|
|
73
73
|
* Groups come from the config; items come from loaded page data.
|
|
74
74
|
*/
|
|
75
75
|
export function buildNavFromPages(tab, pagesByPath, prettyUrls = false) {
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
const navGroups = [];
|
|
77
|
+
const sourceGroups = tab.source.kind === "markdown" ? tab.source.groups : tab.groups;
|
|
78
|
+
if (sourceGroups) {
|
|
79
|
+
for (const group of sourceGroups) {
|
|
79
80
|
const items = [];
|
|
80
81
|
for (const rp of group.pages) {
|
|
81
82
|
const page = pagesByPath.get(rp.slug);
|
|
82
83
|
if (!page)
|
|
83
84
|
continue;
|
|
84
85
|
items.push({
|
|
85
|
-
label: page.title,
|
|
86
|
+
label: rp.label ?? page.title,
|
|
86
87
|
href: navHref(pageOutputPath(tab.slug, page.slug, prettyUrls), prettyUrls),
|
|
87
88
|
id: page.slug,
|
|
88
89
|
});
|
|
89
90
|
}
|
|
90
|
-
|
|
91
|
+
navGroups.push({ label: group.label, items });
|
|
91
92
|
}
|
|
92
93
|
}
|
|
93
|
-
const firstItem =
|
|
94
|
+
const firstItem = navGroups[0]?.items[0];
|
|
94
95
|
const href = firstItem?.href ?? (tab.slug ? `${tab.slug}/` : "");
|
|
95
96
|
return {
|
|
96
97
|
label: tab.label,
|
|
97
98
|
slug: tab.slug,
|
|
98
99
|
href,
|
|
99
100
|
kind: "docs",
|
|
100
|
-
groups,
|
|
101
|
+
groups: navGroups,
|
|
101
102
|
};
|
|
102
103
|
}
|
|
103
104
|
/**
|
|
@@ -19,6 +19,16 @@ export interface SearchEntry {
|
|
|
19
19
|
category: string;
|
|
20
20
|
/** Featured in default search results */
|
|
21
21
|
featured?: boolean;
|
|
22
|
+
/** Source adapter symbol kind, e.g. C++ function, enumvalue, typedef */
|
|
23
|
+
symbolKind?: string;
|
|
24
|
+
/** Owning symbol, e.g. icy::Application */
|
|
25
|
+
owner?: string;
|
|
26
|
+
/** Owning symbol kind, e.g. class, struct, enum */
|
|
27
|
+
ownerKind?: string;
|
|
28
|
+
/** Namespace for source languages that expose one */
|
|
29
|
+
namespace?: string;
|
|
30
|
+
/** Fully qualified symbol name */
|
|
31
|
+
qualifiedName?: string;
|
|
22
32
|
}
|
|
23
33
|
/**
|
|
24
34
|
* Build a search index from specs and markdown pages.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-indexer.d.ts","sourceRoot":"","sources":["../../src/core/search-indexer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AASjD,MAAM,WAAW,WAAW;IAC1B,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,OAAO,EAAE,MAAM,CAAC;IAChB,mDAAmD;IACnD,GAAG,EAAE,MAAM,CAAC;IACZ,qCAAqC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8BAA8B;IAC9B,IAAI,CAAC,EAA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AE,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC,EAC9B,UAAU,EAAE,cAAc,EAC1B,SAAS,SAAM,EACf,aAAa,GAAE,MAAM,EAAO,EAC5B,UAAU,GAAE,UAAkB,GAC7B,MAAM,CAiGR"}
|
|
@@ -75,6 +75,11 @@ export function buildSearchIndex(specs, pages, navigation, assetBase = "/", feat
|
|
|
75
75
|
url: entry.anchor ? `${href}#${entry.anchor}` : href,
|
|
76
76
|
tab: tabLabel,
|
|
77
77
|
category: entry.category,
|
|
78
|
+
...(entry.symbolKind && { symbolKind: entry.symbolKind }),
|
|
79
|
+
...(entry.owner && { owner: entry.owner }),
|
|
80
|
+
...(entry.ownerKind && { ownerKind: entry.ownerKind }),
|
|
81
|
+
...(entry.namespace && { namespace: entry.namespace }),
|
|
82
|
+
...(entry.qualifiedName && { qualifiedName: entry.qualifiedName }),
|
|
78
83
|
});
|
|
79
84
|
}
|
|
80
85
|
}
|
package/dist/dev-server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev-server.d.ts","sourceRoot":"","sources":["../src/dev-server.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dev-server.d.ts","sourceRoot":"","sources":["../src/dev-server.ts"],"names":[],"mappings":"AAyDA,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,wBAAsB,cAAc,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CA2c7E"}
|