@dogsbay/commands 0.2.0-beta.183 → 0.2.0-beta.184
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/menu-edit.d.ts +2 -2
- package/dist/indexes.js +29 -3
- package/package.json +6 -6
|
@@ -28,9 +28,9 @@ export declare const mapAddRefCommand: import("../engine.js").CommandDef<z.ZodOb
|
|
|
28
28
|
toc: z.ZodOptional<z.ZodBoolean>;
|
|
29
29
|
unlisted: z.ZodOptional<z.ZodBoolean>;
|
|
30
30
|
singlePage: z.ZodOptional<z.ZodEnum<{
|
|
31
|
+
children: "children";
|
|
31
32
|
yes: "yes";
|
|
32
33
|
no: "no";
|
|
33
|
-
children: "children";
|
|
34
34
|
}>>;
|
|
35
35
|
}, z.core.$strict>>;
|
|
36
36
|
export declare const mapMoveRefCommand: import("../engine.js").CommandDef<z.ZodObject<{
|
|
@@ -54,8 +54,8 @@ export declare const mapSetPropsCommand: import("../engine.js").CommandDef<z.Zod
|
|
|
54
54
|
toc: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
55
55
|
unlisted: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
56
56
|
singlePage: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
57
|
+
children: "children";
|
|
57
58
|
yes: "yes";
|
|
58
59
|
no: "no";
|
|
59
|
-
children: "children";
|
|
60
60
|
}>>>;
|
|
61
61
|
}, z.core.$strict>>;
|
package/dist/indexes.js
CHANGED
|
@@ -42,7 +42,10 @@ const inlineText = (nodes) => {
|
|
|
42
42
|
return node.text;
|
|
43
43
|
case "link":
|
|
44
44
|
case "highlight":
|
|
45
|
+
case "when":
|
|
45
46
|
return inlineText(node.children);
|
|
47
|
+
case "choice-value":
|
|
48
|
+
return node.form === "link" && node.children?.length ? inlineText(node.children) : (node.text ?? "");
|
|
46
49
|
default:
|
|
47
50
|
return "";
|
|
48
51
|
}
|
|
@@ -193,6 +196,7 @@ const scanInline = (state, nodes) => {
|
|
|
193
196
|
break;
|
|
194
197
|
}
|
|
195
198
|
case "highlight":
|
|
199
|
+
case "when":
|
|
196
200
|
scanInline(state, node.children);
|
|
197
201
|
break;
|
|
198
202
|
default:
|
|
@@ -290,7 +294,18 @@ const scanFrontmatter = (source) => {
|
|
|
290
294
|
const TEMPLATE_PAGE = /^template:[ \t]*["']?jinja["']?[ \t]*$/m;
|
|
291
295
|
const NOT_TEMPLATE = /^template:[ \t]*false[ \t]*$/m;
|
|
292
296
|
const NO_PREPROCESS = /^preprocess:[ \t]*false[ \t]*$/m;
|
|
293
|
-
|
|
297
|
+
/** The config attributes of each build a page is in: the variants of the deepest source folder holding it. */
|
|
298
|
+
const buildAttributes = (variants, path) => {
|
|
299
|
+
const holding = variants.filter((v) => inFolder(path, v.path));
|
|
300
|
+
const deepest = Math.max(-1, ...holding.map((v) => v.path.length));
|
|
301
|
+
return holding.filter((v) => v.path.length === deepest).map((v) => v.attributes);
|
|
302
|
+
};
|
|
303
|
+
/**
|
|
304
|
+
* `attributeSets`: the config `attributes:` of each build the page is in (its content source's,
|
|
305
|
+
* over the site's). A migrated AsciiDoc heading whose id comes from an attribute's value
|
|
306
|
+
* (`asciidoc-title`) gets the id the first build gives it; the other builds' ids are anchors too.
|
|
307
|
+
*/
|
|
308
|
+
const indexDoc = (path, source, templateSource = false, attributeSets = []) => {
|
|
294
309
|
const front = scanFrontmatter(source);
|
|
295
310
|
// where the body starts: past the closing `---` line of a terminated block
|
|
296
311
|
let bodyStart = 0;
|
|
@@ -409,7 +424,7 @@ const indexDoc = (path, source, templateSource = false) => {
|
|
|
409
424
|
if (typeof frontmatter.title === "string")
|
|
410
425
|
entry.title = frontmatter.title;
|
|
411
426
|
// THE slug pass, read without changing the tree (render-html's ids, the Astro build's)
|
|
412
|
-
state.pageIds = headingIds(tree);
|
|
427
|
+
state.pageIds = headingIds(tree, { attributes: attributeSets[0] });
|
|
413
428
|
scanTree(state, tree);
|
|
414
429
|
// Lines for links: each href's successive occurrences in the code-masked source, in
|
|
415
430
|
// document order (the tree carries no positions) — a repeated href maps to the next
|
|
@@ -443,6 +458,15 @@ const indexDoc = (path, source, templateSource = false) => {
|
|
|
443
458
|
}
|
|
444
459
|
};
|
|
445
460
|
walkSlugs(tree);
|
|
461
|
+
// another build with other attribute values gives such a heading another id: a link may use it
|
|
462
|
+
if (attributeSets.length > 1 && source.includes("asciidoc-title=")) {
|
|
463
|
+
for (const attributes of attributeSets.slice(1)) {
|
|
464
|
+
for (const [node, given] of headingIds(tree, { attributes })) {
|
|
465
|
+
if (node.type === "heading" && given.generated && given.id)
|
|
466
|
+
entry.anchors.push(given.id);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
}
|
|
446
470
|
entry.headings.forEach((h, i) => { const slug = slugs[i]; if (slug && !h.id)
|
|
447
471
|
h.slug = slug; });
|
|
448
472
|
// headings with no `{#id}`: the slug the site gives them, after the authored targets
|
|
@@ -642,7 +666,9 @@ export async function buildWorkspaceIndex(storage, options = {}) {
|
|
|
642
666
|
}
|
|
643
667
|
else if (isDocPath(path)) {
|
|
644
668
|
if (!(reuse && docs.has(path)))
|
|
645
|
-
docs.set(path, indexDoc(path, await storage.read(path), config.templateSources.some((dir) => inFolder(path, dir))
|
|
669
|
+
docs.set(path, indexDoc(path, await storage.read(path), config.templateSources.some((dir) => inFolder(path, dir)),
|
|
670
|
+
// the builds this page is in: its content source's (the deepest folder holding it)
|
|
671
|
+
buildAttributes(config.variants, path)));
|
|
646
672
|
}
|
|
647
673
|
}
|
|
648
674
|
// menu files reached only by an include (`api/part.yml`): indexed too, to a fixpoint. A "/"-rooted
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dogsbay/commands",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.184",
|
|
4
4
|
"description": "Typed, headless-first command engine for the Dogsbay platform — one zod-defined command yields CLI, JSON-RPC, and MCP surfaces",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
"js-yaml": "^5.2.1",
|
|
36
36
|
"yaml": "^2.9.0",
|
|
37
37
|
"zod": "^4.4.3",
|
|
38
|
-
"@dogsbay/format-dogsbay-md": "0.2.0-beta.
|
|
39
|
-
"@dogsbay/
|
|
40
|
-
"@dogsbay/
|
|
41
|
-
"@dogsbay/render": "0.2.0-beta.
|
|
42
|
-
"@dogsbay/types": "0.2.0-beta.
|
|
38
|
+
"@dogsbay/format-dogsbay-md": "0.2.0-beta.184",
|
|
39
|
+
"@dogsbay/format-topicmap": "0.2.0-beta.184",
|
|
40
|
+
"@dogsbay/minja": "0.2.0-beta.184",
|
|
41
|
+
"@dogsbay/render": "0.2.0-beta.184",
|
|
42
|
+
"@dogsbay/types": "0.2.0-beta.184"
|
|
43
43
|
},
|
|
44
44
|
"license": "MIT",
|
|
45
45
|
"repository": {
|