@dogsbay/ssg-cli 0.2.0-beta.179 → 0.2.0-beta.181
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/THIRD-PARTY-NOTICES.txt +17 -17
- package/chunks/{build-command-6FIW5T7T.mjs → build-command-VO7SKUVH.mjs} +5 -4
- package/chunks/{check-command-57FHOWYE.mjs → check-command-UVSGIYBI.mjs} +8 -6
- package/chunks/chunk-3ZUDN6IL.mjs +14481 -0
- package/chunks/{chunk-NWU47LUN.mjs → chunk-FTSK7GL6.mjs} +8 -6
- package/chunks/chunk-IERF2DNL.mjs +24810 -0
- package/chunks/{chunk-IZF74GZZ.mjs → chunk-O3R3MASP.mjs} +5739 -170
- package/chunks/{core-WLSK2LVY.mjs → core-7XI62A25.mjs} +2 -4
- package/chunks/{dev-OX4NVOZ3.mjs → dev-LUUO2CTK.mjs} +11 -10
- package/chunks/menu-N2AZSZKS.mjs +88 -0
- package/chunks/{publish-command-EPRXQCMM.mjs → publish-command-7WTTDYPN.mjs} +3 -3
- package/chunks/{release-diff-VEGTEHOM.mjs → release-diff-GFTKWVAD.mjs} +4 -4
- package/cli.mjs +6 -6
- package/package.json +2 -2
- package/chunks/chunk-5APY2GH6.mjs +0 -5122
- package/chunks/chunk-LOCUA7KI.mjs +0 -33637
- package/chunks/chunk-Z7WUDBZV.mjs +0 -5577
- package/chunks/topicmap-IGUURUBF.mjs +0 -383
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
3
3
|
import {
|
|
4
|
-
lib_default
|
|
5
|
-
} from "./chunk-Z7WUDBZV.mjs";
|
|
6
|
-
import {
|
|
4
|
+
lib_default,
|
|
7
5
|
require_dist
|
|
8
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-O3R3MASP.mjs";
|
|
9
7
|
import {
|
|
10
8
|
__toESM
|
|
11
9
|
} from "./chunk-STRHO6SY.mjs";
|
|
@@ -7,23 +7,22 @@ import {
|
|
|
7
7
|
} from "./chunk-OBUK53NJ.mjs";
|
|
8
8
|
import {
|
|
9
9
|
ConfigError,
|
|
10
|
+
MENU_FILE,
|
|
10
11
|
PageClashError,
|
|
11
|
-
TOPIC_MAP,
|
|
12
12
|
assetVerdict,
|
|
13
13
|
build,
|
|
14
14
|
copiedPath,
|
|
15
15
|
dataDirOf,
|
|
16
16
|
defaultTables,
|
|
17
|
-
filePagesIndex,
|
|
18
17
|
insideProject,
|
|
19
18
|
languageTables,
|
|
20
19
|
memberPaths,
|
|
21
20
|
parseConfig,
|
|
22
21
|
projectFile,
|
|
23
22
|
projectRoots,
|
|
23
|
+
readMenus,
|
|
24
24
|
readProject,
|
|
25
25
|
readText,
|
|
26
|
-
readTopicMaps,
|
|
27
26
|
rebuildUnitLazy,
|
|
28
27
|
servedRoot,
|
|
29
28
|
siteCssBuilder,
|
|
@@ -33,14 +32,16 @@ import {
|
|
|
33
32
|
translationTables,
|
|
34
33
|
versionsOf,
|
|
35
34
|
writeTranslationStubs
|
|
36
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-3ZUDN6IL.mjs";
|
|
37
36
|
import {
|
|
38
37
|
contentType
|
|
39
38
|
} from "./chunk-CMGKSS45.mjs";
|
|
40
39
|
import "./chunk-KFYMG4VB.mjs";
|
|
41
|
-
import
|
|
40
|
+
import {
|
|
41
|
+
filePagesIndex
|
|
42
|
+
} from "./chunk-IERF2DNL.mjs";
|
|
42
43
|
import "./chunk-YVSP26OS.mjs";
|
|
43
|
-
import "./chunk-
|
|
44
|
+
import "./chunk-O3R3MASP.mjs";
|
|
44
45
|
import {
|
|
45
46
|
collectClasses,
|
|
46
47
|
isRef,
|
|
@@ -366,7 +367,6 @@ async function openDevSession(input, o = {}) {
|
|
|
366
367
|
mark("unit");
|
|
367
368
|
continue;
|
|
368
369
|
}
|
|
369
|
-
if (TOPIC_MAP.test(p)) continue;
|
|
370
370
|
if (config.staticDir && p.startsWith(config.staticDir + "/")) {
|
|
371
371
|
const rel = p.slice(config.staticDir.length + 1);
|
|
372
372
|
if (rel === "_headers" || rel === "_redirects" || !staticPathServed(rel)) continue;
|
|
@@ -409,6 +409,7 @@ async function openDevSession(input, o = {}) {
|
|
|
409
409
|
}
|
|
410
410
|
continue;
|
|
411
411
|
}
|
|
412
|
+
if (MENU_FILE.test(p) && !NAV_FILES.test(p)) continue;
|
|
412
413
|
const u = unitOf(p);
|
|
413
414
|
if (!u) continue;
|
|
414
415
|
const content = input.files.get(p);
|
|
@@ -654,7 +655,7 @@ async function dev(projectDir, port, o = {}) {
|
|
|
654
655
|
files.clear();
|
|
655
656
|
for (const [k, v] of readProject(project, projectRoots(cfg), [outDir])) files.set(k, v);
|
|
656
657
|
if (cfgName && text !== void 0) files.set(cfgName, text);
|
|
657
|
-
navMaps = new Set(await
|
|
658
|
+
navMaps = new Set(await readMenus(project, cfg, files, [outDir]));
|
|
658
659
|
return true;
|
|
659
660
|
};
|
|
660
661
|
await layout(cfgText);
|
|
@@ -746,9 +747,9 @@ data: ${data ?? generation}
|
|
|
746
747
|
}
|
|
747
748
|
}
|
|
748
749
|
}
|
|
749
|
-
if ([...changed].some((p) =>
|
|
750
|
+
if ([...changed].some((p) => MENU_FILE.test(p) || navMaps.has(p))) {
|
|
750
751
|
const before = new Set(files.keys());
|
|
751
|
-
navMaps = new Set(await
|
|
752
|
+
navMaps = new Set(await readMenus(project, cfg, files, [outDir]));
|
|
752
753
|
for (const k of files.keys()) if (!before.has(k)) changed.add(k);
|
|
753
754
|
}
|
|
754
755
|
} catch (e) {
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
NOT_A_MENU_CODES,
|
|
5
|
+
menuToNav,
|
|
6
|
+
navFromMenu,
|
|
7
|
+
normalize,
|
|
8
|
+
oldStylePaths,
|
|
9
|
+
parseMenu,
|
|
10
|
+
resolveMenuFile,
|
|
11
|
+
slugFromPath
|
|
12
|
+
} from "./chunk-IERF2DNL.mjs";
|
|
13
|
+
import "./chunk-YVSP26OS.mjs";
|
|
14
|
+
import "./chunk-O3R3MASP.mjs";
|
|
15
|
+
import "./chunk-G6OTOD3B.mjs";
|
|
16
|
+
import "./chunk-STRHO6SY.mjs";
|
|
17
|
+
|
|
18
|
+
// src/core/menu.ts
|
|
19
|
+
var MENU_FILES = ["nav.yml", "nav.yaml", "nav.json"];
|
|
20
|
+
async function sourceMenu(path, contentRoot, read, variables, found, has) {
|
|
21
|
+
const root = normalize(path.replace(/^\.\//, ""));
|
|
22
|
+
const content = contentRoot.replace(/\/+$/, "");
|
|
23
|
+
const files = [];
|
|
24
|
+
const result = await resolveMenuFile(root, {
|
|
25
|
+
contentRoot: content,
|
|
26
|
+
variables,
|
|
27
|
+
loader: async (p) => {
|
|
28
|
+
const at = normalize(p);
|
|
29
|
+
if (at === ".." || at.startsWith("../") || at.startsWith("/")) throw new Error(`${p} is outside the project`);
|
|
30
|
+
const text = await read(at);
|
|
31
|
+
if (text === void 0) throw new Error("no such file");
|
|
32
|
+
files.push(at);
|
|
33
|
+
return text;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
const errors = [...result.errors];
|
|
37
|
+
if (found) {
|
|
38
|
+
const why = errors.find((e) => e.file === root && NOT_A_MENU_CODES.has(e.code));
|
|
39
|
+
if (why) return { path: root, entries: [], files, errors: [], notAMenu: why };
|
|
40
|
+
}
|
|
41
|
+
if (!errors.some((e) => e.file === root && e.code === "load-failed")) {
|
|
42
|
+
const text = await read(root);
|
|
43
|
+
if (text !== void 0) errors.push(...await oldStylePaths(text, root, content, (p) => has(p.replace(/^\/+/, ""))));
|
|
44
|
+
}
|
|
45
|
+
return { path: root, entries: result.entries, files: result.files.length ? result.files : files, errors };
|
|
46
|
+
}
|
|
47
|
+
function menuError(menu) {
|
|
48
|
+
const problems = menu.errors.filter((e) => e.severity !== "warning");
|
|
49
|
+
if (!problems.length) return void 0;
|
|
50
|
+
const details = problems.map((e) => ` \u2717 ${e.file}${e.line ? `:${e.line}` : ""}: [${e.code}] ${e.message}`).join("\n");
|
|
51
|
+
return new Error(`The menu ${menu.path} has ${problems.length} problem(s):
|
|
52
|
+
${details}
|
|
53
|
+
Check it with: dogsbay nav check ${menu.path}`);
|
|
54
|
+
}
|
|
55
|
+
function menuNav(entries, labelFor) {
|
|
56
|
+
return navFromMenu(menuToNav(entries, (file) => labelFor(slugFromPath(file))));
|
|
57
|
+
}
|
|
58
|
+
function navFromText(text, labelFor, baseDir = "", file = "nav file") {
|
|
59
|
+
const { entries, errors } = parseMenu(text, file);
|
|
60
|
+
const error = errors.find((e) => e.severity !== "warning");
|
|
61
|
+
if (error) throw new Error(`${file}${error.line ? `:${error.line}` : ""}: ${error.message}`);
|
|
62
|
+
const plain = (list) => list.map((e) => {
|
|
63
|
+
if (e.include !== void 0) throw new Error(`${file}${e.line ? `:${e.line}` : ""}: include: ${e.include} needs the site build, which reads included menu files`);
|
|
64
|
+
const out = { ...e };
|
|
65
|
+
if (out.file !== void 0) {
|
|
66
|
+
const f = out.file.replace(/^\/+/, "");
|
|
67
|
+
out.file = baseDir ? `${baseDir}/${f}` : f;
|
|
68
|
+
}
|
|
69
|
+
if (out.children) out.children = plain(out.children);
|
|
70
|
+
return out;
|
|
71
|
+
});
|
|
72
|
+
return navFromMenu(menuToNav(plain(entries), (f) => labelFor(slugFromPath(f))));
|
|
73
|
+
}
|
|
74
|
+
function parseNavYaml(text, labelFor, baseDir = "") {
|
|
75
|
+
return navFromText(text, labelFor, baseDir, "nav.yml");
|
|
76
|
+
}
|
|
77
|
+
function parseNavJson(text, labelFor) {
|
|
78
|
+
return navFromText(text, labelFor, "", "nav.json");
|
|
79
|
+
}
|
|
80
|
+
export {
|
|
81
|
+
MENU_FILES,
|
|
82
|
+
menuError,
|
|
83
|
+
menuNav,
|
|
84
|
+
navFromText,
|
|
85
|
+
parseNavJson,
|
|
86
|
+
parseNavYaml,
|
|
87
|
+
sourceMenu
|
|
88
|
+
};
|
|
@@ -4,9 +4,9 @@ import {
|
|
|
4
4
|
copiedPath,
|
|
5
5
|
parseConfig,
|
|
6
6
|
readBuildFiles
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-3ZUDN6IL.mjs";
|
|
8
8
|
import "./chunk-KFYMG4VB.mjs";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-IERF2DNL.mjs";
|
|
10
10
|
import {
|
|
11
11
|
UsageError,
|
|
12
12
|
flag,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
positional
|
|
15
15
|
} from "./chunk-LNWQN7K7.mjs";
|
|
16
16
|
import "./chunk-YVSP26OS.mjs";
|
|
17
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-O3R3MASP.mjs";
|
|
18
18
|
import {
|
|
19
19
|
TEXT_FILE,
|
|
20
20
|
isLazyText,
|
|
@@ -9,17 +9,17 @@ import {
|
|
|
9
9
|
releaseDiff,
|
|
10
10
|
releaseExitCode,
|
|
11
11
|
releaseRedirects
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-FTSK7GL6.mjs";
|
|
13
13
|
import {
|
|
14
14
|
buildUnits,
|
|
15
15
|
parseConfig,
|
|
16
16
|
readBuildFiles,
|
|
17
17
|
versionsOf
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-3ZUDN6IL.mjs";
|
|
19
19
|
import "./chunk-KFYMG4VB.mjs";
|
|
20
|
-
import "./chunk-
|
|
20
|
+
import "./chunk-IERF2DNL.mjs";
|
|
21
21
|
import "./chunk-YVSP26OS.mjs";
|
|
22
|
-
import "./chunk-
|
|
22
|
+
import "./chunk-O3R3MASP.mjs";
|
|
23
23
|
import "./chunk-JABACD5T.mjs";
|
|
24
24
|
import "./chunk-G6OTOD3B.mjs";
|
|
25
25
|
import "./chunk-STRHO6SY.mjs";
|
package/cli.mjs
CHANGED
|
@@ -37,16 +37,16 @@ async function main() {
|
|
|
37
37
|
usage(1);
|
|
38
38
|
}
|
|
39
39
|
if (wantsHelp(args)) usage(0, cmd);
|
|
40
|
-
if (cmd === "build") return (await import("./chunks/build-command-
|
|
41
|
-
if (cmd === "assemble") return (await import("./chunks/build-command-
|
|
42
|
-
if (cmd === "check") return (await import("./chunks/check-command-
|
|
43
|
-
if (cmd === "publish") return (await import("./chunks/publish-command-
|
|
40
|
+
if (cmd === "build") return (await import("./chunks/build-command-VO7SKUVH.mjs")).runBuild(args, HIGHLIGHT_WORKER);
|
|
41
|
+
if (cmd === "assemble") return (await import("./chunks/build-command-VO7SKUVH.mjs")).runBuild(args, HIGHLIGHT_WORKER, { assemble: true });
|
|
42
|
+
if (cmd === "check") return (await import("./chunks/check-command-UVSGIYBI.mjs")).runCheck(args);
|
|
43
|
+
if (cmd === "publish") return (await import("./chunks/publish-command-7WTTDYPN.mjs")).runPublish(args);
|
|
44
44
|
if (cmd === "release-diff") {
|
|
45
45
|
const from = option(args, "--from")[0];
|
|
46
46
|
const gitFrom = option(args, "--git-from")[0];
|
|
47
47
|
const o = { from, gitFrom, json: flag(args, "--json"), write: flag(args, "--write"), candidates: flag(args, "--candidates"), strict: flag(args, "--strict") };
|
|
48
48
|
const project = resolve(positional(args, "."));
|
|
49
|
-
const { runReleaseDiff } = await import("./chunks/release-diff-
|
|
49
|
+
const { runReleaseDiff } = await import("./chunks/release-diff-GFTKWVAD.mjs");
|
|
50
50
|
process.exitCode = await runReleaseDiff(project, o);
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
@@ -58,7 +58,7 @@ async function main() {
|
|
|
58
58
|
const llms = flag(args, "--llms");
|
|
59
59
|
const project = resolve(positional(args, "."));
|
|
60
60
|
const t0 = performance.now();
|
|
61
|
-
const { dev, readyLine, serverUrl } = await import("./chunks/dev-
|
|
61
|
+
const { dev, readyLine, serverUrl } = await import("./chunks/dev-LUUO2CTK.mjs");
|
|
62
62
|
const { server } = await dev(project, port, { diagrams: !noDiagrams, lazy, search: noSearchDev ? false : void 0, llms, token: process.env.DOGSBAY_DEV_TOKEN || void 0, listening: (s) => console.log(readyLine(s)) });
|
|
63
63
|
console.log(`dev server for ${project} at ${serverUrl(server)} (ready in ${Math.round(performance.now() - t0)} ms); watching for changes`);
|
|
64
64
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dogsbay/ssg-cli",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.181",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The dogsbay-ssg command: build, check, preview and publish Dogsbay-MD documentation sites that work offline",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"NOTICE"
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@dogsbay/icons": "0.2.0-beta.
|
|
21
|
+
"@dogsbay/icons": "0.2.0-beta.181",
|
|
22
22
|
"@mermanjs/web-render": "0.9.3"
|
|
23
23
|
},
|
|
24
24
|
"publishConfig": {
|