@dogsbay/ssg-cli 0.0.0-stage → 0.2.0-beta.167.1
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/LICENSE +201 -0
- package/NOTICE +17 -0
- package/README.md +62 -2
- package/THIRD-PARTY-NOTICES.txt +2363 -0
- package/chunks/bash-WN2IW2MU.mjs +9 -0
- package/chunks/bat-KLYVST7G.mjs +12 -0
- package/chunks/build-command-WQJANVGR.mjs +409 -0
- package/chunks/c-NBVQ7G3X.mjs +9 -0
- package/chunks/check-command-QTJ6BUNL.mjs +215 -0
- package/chunks/chunk-4KDUWLRS.mjs +12 -0
- package/chunks/chunk-CMGKSS45.mjs +34 -0
- package/chunks/chunk-CUTL24GH.mjs +12 -0
- package/chunks/chunk-ECAZ77NS.mjs +12 -0
- package/chunks/chunk-F6VRYHSY.mjs +5048 -0
- package/chunks/chunk-FJPQZU44.mjs +12 -0
- package/chunks/chunk-G6OTOD3B.mjs +48 -0
- package/chunks/chunk-GIP2FIA6.mjs +12 -0
- package/chunks/chunk-IAR2KPZC.mjs +12 -0
- package/chunks/chunk-IZF74GZZ.mjs +7340 -0
- package/chunks/chunk-JABACD5T.mjs +93 -0
- package/chunks/chunk-JRPXZBM2.mjs +12 -0
- package/chunks/chunk-JXFQPMYJ.mjs +43806 -0
- package/chunks/chunk-JXM2XRAR.mjs +16 -0
- package/chunks/chunk-KEHZHWE6.mjs +12 -0
- package/chunks/chunk-LC74DHS3.mjs +28 -0
- package/chunks/chunk-LNWQN7K7.mjs +47 -0
- package/chunks/chunk-NJDUOQI7.mjs +12 -0
- package/chunks/chunk-OBUK53NJ.mjs +154 -0
- package/chunks/chunk-STRHO6SY.mjs +44 -0
- package/chunks/chunk-TIRB4ROQ.mjs +20 -0
- package/chunks/chunk-UKZGJ5AP.mjs +11201 -0
- package/chunks/chunk-USOBJLOJ.mjs +12 -0
- package/chunks/chunk-X4ZSG4OM.mjs +12 -0
- package/chunks/chunk-XABJJODS.mjs +16 -0
- package/chunks/chunk-XYPTZFVB.mjs +31503 -0
- package/chunks/chunk-YVSP26OS.mjs +175 -0
- package/chunks/chunk-Z7WUDBZV.mjs +5577 -0
- package/chunks/chunk-ZPII4MCC.mjs +12 -0
- package/chunks/chunk-ZW635UYF.mjs +44 -0
- package/chunks/core-Z65HALUT.mjs +5926 -0
- package/chunks/cpp-JNQSOSM7.mjs +11 -0
- package/chunks/csharp-UTVXXLBH.mjs +12 -0
- package/chunks/css-DR3MZC2R.mjs +9 -0
- package/chunks/css-build-WUW5N4IC.mjs +6290 -0
- package/chunks/dev-X3Y5P4KI.mjs +979 -0
- package/chunks/diff-GTIUNONZ.mjs +12 -0
- package/chunks/docker-2O2WO47V.mjs +12 -0
- package/chunks/go-KFRO4WHX.mjs +12 -0
- package/chunks/graphql-H4XAFKUQ.mjs +13 -0
- package/chunks/groovy-IAOB4GSA.mjs +12 -0
- package/chunks/hcl-OV4NBCSV.mjs +12 -0
- package/chunks/highlight-XB2G5VI5.mjs +16 -0
- package/chunks/html-HNUETIJT.mjs +11 -0
- package/chunks/http-POY7GQIM.mjs +33 -0
- package/chunks/ini-ZWSSZBAD.mjs +9 -0
- package/chunks/java-UNHKAALA.mjs +9 -0
- package/chunks/javascript-5I4F2MOK.mjs +9 -0
- package/chunks/json-HUSK22EN.mjs +9 -0
- package/chunks/jsonc-3FJRQVYX.mjs +12 -0
- package/chunks/jsx-MPXQICPA.mjs +9 -0
- package/chunks/katex-assets-2JWTS7KK.mjs +11 -0
- package/chunks/kotlin-44HLBZQT.mjs +12 -0
- package/chunks/makefile-MN7GTSOT.mjs +12 -0
- package/chunks/markdown-BSJW56ZV.mjs +12 -0
- package/chunks/math-VI3BIAAZ.mjs +14509 -0
- package/chunks/nginx-THNEASQW.mjs +17 -0
- package/chunks/pele-SYMSY5GD.mjs +20582 -0
- package/chunks/powershell-FLIIURPX.mjs +12 -0
- package/chunks/properties-5JRW4GXO.mjs +9 -0
- package/chunks/publish-command-J7KGJTLD.mjs +858 -0
- package/chunks/python-AMYOSLZN.mjs +12 -0
- package/chunks/release-diff-JMNCG2T7.mjs +108 -0
- package/chunks/ruby-45KKBAF3.mjs +69 -0
- package/chunks/rust-HHHRMWV3.mjs +12 -0
- package/chunks/scss-SXP65CI5.mjs +16 -0
- package/chunks/serve-CUWABTUV.mjs +66 -0
- package/chunks/shellsession-Z5NIGXRL.mjs +16 -0
- package/chunks/sql-BZT6ET7H.mjs +9 -0
- package/chunks/toml-U6LUKYDZ.mjs +12 -0
- package/chunks/topicmap-V7FYXTVQ.mjs +383 -0
- package/chunks/tsx-65AAFPTH.mjs +9 -0
- package/chunks/typescript-P7INMWMZ.mjs +9 -0
- package/chunks/xml-OWRWNCOT.mjs +10 -0
- package/chunks/xsl-CDSW6KM4.mjs +17 -0
- package/chunks/yaml-GNE6PFDT.mjs +9 -0
- package/cli.mjs +83 -0
- package/highlight-worker.mjs +20 -0
- package/package.json +25 -4
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
MemoryLoader,
|
|
5
|
+
dirname,
|
|
6
|
+
load,
|
|
7
|
+
normalize,
|
|
8
|
+
render
|
|
9
|
+
} from "./chunk-F6VRYHSY.mjs";
|
|
10
|
+
import {
|
|
11
|
+
require_dist
|
|
12
|
+
} from "./chunk-IZF74GZZ.mjs";
|
|
13
|
+
import {
|
|
14
|
+
__toESM
|
|
15
|
+
} from "./chunk-STRHO6SY.mjs";
|
|
16
|
+
|
|
17
|
+
// node_modules/@dogsbay/format-topicmap/dist/parse.js
|
|
18
|
+
var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
19
|
+
var parseEntry = (raw, mapPath, pointer, errors) => {
|
|
20
|
+
if (!isRecord(raw)) {
|
|
21
|
+
errors.push({
|
|
22
|
+
mapPath,
|
|
23
|
+
code: "invalid-entry",
|
|
24
|
+
message: `${pointer}: entry must be a mapping, got ${Array.isArray(raw) ? "array" : typeof raw}`
|
|
25
|
+
});
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
const entry = {};
|
|
29
|
+
if (raw.navtitle !== void 0) {
|
|
30
|
+
if (typeof raw.navtitle !== "string" || raw.navtitle.trim().length === 0) {
|
|
31
|
+
errors.push({ mapPath, code: "invalid-entry", message: `${pointer}: navtitle must be a non-empty string` });
|
|
32
|
+
} else {
|
|
33
|
+
entry.navtitle = raw.navtitle;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (raw.href !== void 0) {
|
|
37
|
+
if (typeof raw.href !== "string" || raw.href.length === 0) {
|
|
38
|
+
errors.push({ mapPath, code: "invalid-entry", message: `${pointer}: href must be a non-empty string` });
|
|
39
|
+
} else {
|
|
40
|
+
entry.href = raw.href;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (raw.format !== void 0) {
|
|
44
|
+
if (raw.format === "topicmap" || raw.format === "md") {
|
|
45
|
+
entry.format = raw.format;
|
|
46
|
+
} else {
|
|
47
|
+
errors.push({
|
|
48
|
+
mapPath,
|
|
49
|
+
code: "invalid-entry",
|
|
50
|
+
message: `${pointer}: format must be "topicmap" or "md", got ${JSON.stringify(raw.format)}`
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (raw.toc !== void 0) {
|
|
55
|
+
if (typeof raw.toc !== "boolean") {
|
|
56
|
+
errors.push({ mapPath, code: "invalid-entry", message: `${pointer}: toc must be a boolean` });
|
|
57
|
+
} else {
|
|
58
|
+
entry.toc = raw.toc;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (raw.singlePage !== void 0) {
|
|
62
|
+
if (raw.singlePage === "yes" || raw.singlePage === "no" || raw.singlePage === "children") {
|
|
63
|
+
entry.singlePage = raw.singlePage;
|
|
64
|
+
} else {
|
|
65
|
+
errors.push({
|
|
66
|
+
mapPath,
|
|
67
|
+
code: "invalid-entry",
|
|
68
|
+
message: `${pointer}: singlePage must be "yes", "no" or "children"`
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (raw.meta !== void 0) {
|
|
73
|
+
if (isRecord(raw.meta)) {
|
|
74
|
+
entry.meta = raw.meta;
|
|
75
|
+
} else {
|
|
76
|
+
errors.push({ mapPath, code: "invalid-entry", message: `${pointer}: meta must be a mapping` });
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (raw.topics !== void 0 && raw.topics !== null) {
|
|
80
|
+
if (!Array.isArray(raw.topics)) {
|
|
81
|
+
errors.push({ mapPath, code: "invalid-entry", message: `${pointer}: topics must be an array` });
|
|
82
|
+
} else {
|
|
83
|
+
entry.topics = raw.topics.map((child, i) => parseEntry(child, mapPath, `${pointer}.topics[${i}]`, errors)).filter((child) => child !== null);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (entry.navtitle === void 0 && entry.href === void 0) {
|
|
87
|
+
errors.push({
|
|
88
|
+
mapPath,
|
|
89
|
+
code: "invalid-entry",
|
|
90
|
+
message: `${pointer}: entry needs a navtitle or an href`
|
|
91
|
+
});
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
if (entry.format === "topicmap" && entry.href === void 0) {
|
|
95
|
+
errors.push({
|
|
96
|
+
mapPath,
|
|
97
|
+
code: "invalid-entry",
|
|
98
|
+
message: `${pointer}: format "topicmap" requires an href`
|
|
99
|
+
});
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
return entry;
|
|
103
|
+
};
|
|
104
|
+
var parseTopicMap = (source, mapPath = "") => {
|
|
105
|
+
const errors = [];
|
|
106
|
+
let raw;
|
|
107
|
+
try {
|
|
108
|
+
raw = load(source);
|
|
109
|
+
} catch (error) {
|
|
110
|
+
errors.push({
|
|
111
|
+
mapPath,
|
|
112
|
+
code: "invalid-yaml",
|
|
113
|
+
message: error instanceof Error ? error.message : String(error)
|
|
114
|
+
});
|
|
115
|
+
return { map: null, errors };
|
|
116
|
+
}
|
|
117
|
+
if (!isRecord(raw)) {
|
|
118
|
+
errors.push({ mapPath, code: "invalid-shape", message: "topic map must be a YAML mapping" });
|
|
119
|
+
return { map: null, errors };
|
|
120
|
+
}
|
|
121
|
+
const rawTopics = raw.topics === null ? [] : raw.topics;
|
|
122
|
+
if (!Array.isArray(rawTopics)) {
|
|
123
|
+
errors.push({ mapPath, code: "invalid-shape", message: 'topic map requires a "topics" array' });
|
|
124
|
+
return { map: null, errors };
|
|
125
|
+
}
|
|
126
|
+
const map = {
|
|
127
|
+
topics: rawTopics.map((entry, i) => parseEntry(entry, mapPath, `topics[${i}]`, errors)).filter((entry) => entry !== null)
|
|
128
|
+
};
|
|
129
|
+
if (raw.title !== void 0) {
|
|
130
|
+
if (typeof raw.title === "string") {
|
|
131
|
+
map.title = raw.title;
|
|
132
|
+
} else {
|
|
133
|
+
errors.push({ mapPath, code: "invalid-shape", message: "title must be a string" });
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return { map, errors };
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
// node_modules/@dogsbay/format-topicmap/dist/paths.js
|
|
140
|
+
var normalizePath = (path) => {
|
|
141
|
+
const isAbsolute = path.startsWith("/");
|
|
142
|
+
const parts = path.split("/");
|
|
143
|
+
const out = [];
|
|
144
|
+
for (const part of parts) {
|
|
145
|
+
if (part === "" || part === ".")
|
|
146
|
+
continue;
|
|
147
|
+
if (part === "..") {
|
|
148
|
+
if (out.length > 0 && out[out.length - 1] !== "..") {
|
|
149
|
+
out.pop();
|
|
150
|
+
} else if (!isAbsolute) {
|
|
151
|
+
out.push("..");
|
|
152
|
+
}
|
|
153
|
+
continue;
|
|
154
|
+
}
|
|
155
|
+
out.push(part);
|
|
156
|
+
}
|
|
157
|
+
return (isAbsolute ? "/" : "") + out.join("/");
|
|
158
|
+
};
|
|
159
|
+
var dirname2 = (path) => {
|
|
160
|
+
const normalized = normalizePath(path);
|
|
161
|
+
const idx = normalized.lastIndexOf("/");
|
|
162
|
+
if (idx === -1)
|
|
163
|
+
return "";
|
|
164
|
+
if (idx === 0)
|
|
165
|
+
return "/";
|
|
166
|
+
return normalized.slice(0, idx);
|
|
167
|
+
};
|
|
168
|
+
var joinPath = (...segments) => normalizePath(segments.filter(Boolean).join("/"));
|
|
169
|
+
var isExternalHref = (href) => /^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(href);
|
|
170
|
+
var resolveHref = (href, containingMapPath) => {
|
|
171
|
+
if (isExternalHref(href))
|
|
172
|
+
return href;
|
|
173
|
+
if (href.startsWith("/"))
|
|
174
|
+
return normalizePath(href);
|
|
175
|
+
if (isExternalHref(containingMapPath)) {
|
|
176
|
+
const match = containingMapPath.match(/^([a-zA-Z][a-zA-Z0-9+.-]*:\/\/[^/]+)(\/.*)?$/);
|
|
177
|
+
if (!match)
|
|
178
|
+
return href;
|
|
179
|
+
const origin = match[1];
|
|
180
|
+
const dir = dirname2(match[2] ?? "/") || "/";
|
|
181
|
+
return origin + normalizePath(`${dir}/${href}`);
|
|
182
|
+
}
|
|
183
|
+
return joinPath(dirname2(containingMapPath), href);
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
// node_modules/@dogsbay/format-topicmap/dist/resolve.js
|
|
187
|
+
var DEFAULT_MAX_DEPTH = 10;
|
|
188
|
+
var NO_INCLUDES = new MemoryLoader({});
|
|
189
|
+
var hasTemplateSyntax = (value) => value.includes("{{") || value.includes("{%");
|
|
190
|
+
var renderValue = async (value, variables, mapPath, errors) => {
|
|
191
|
+
if (!hasTemplateSyntax(value))
|
|
192
|
+
return value;
|
|
193
|
+
try {
|
|
194
|
+
return await render(value, {
|
|
195
|
+
context: variables,
|
|
196
|
+
loader: NO_INCLUDES,
|
|
197
|
+
undefinedBehavior: "preserve"
|
|
198
|
+
});
|
|
199
|
+
} catch (error) {
|
|
200
|
+
errors.push({
|
|
201
|
+
mapPath,
|
|
202
|
+
code: "variable-error",
|
|
203
|
+
message: `failed to resolve variables in ${JSON.stringify(value)}: ${error instanceof Error ? error.message : String(error)}`
|
|
204
|
+
});
|
|
205
|
+
return value;
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
var resolveTopicMap = async (rootPath, options) => {
|
|
209
|
+
const { loader, variables = {}, maxDepth = DEFAULT_MAX_DEPTH } = options;
|
|
210
|
+
const errors = [];
|
|
211
|
+
const loadMap = async (path, stack) => {
|
|
212
|
+
const normalized = isExternalHref(path) ? path : normalizePath(path);
|
|
213
|
+
if (stack.includes(normalized)) {
|
|
214
|
+
errors.push({
|
|
215
|
+
mapPath: normalized,
|
|
216
|
+
code: "cycle",
|
|
217
|
+
message: `circular topic map include: ${[...stack, normalized].join(" \u2192 ")}`
|
|
218
|
+
});
|
|
219
|
+
return null;
|
|
220
|
+
}
|
|
221
|
+
if (stack.length >= maxDepth) {
|
|
222
|
+
errors.push({
|
|
223
|
+
mapPath: normalized,
|
|
224
|
+
code: "max-depth",
|
|
225
|
+
message: `maximum topic map depth (${maxDepth}) exceeded`
|
|
226
|
+
});
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
229
|
+
let source;
|
|
230
|
+
try {
|
|
231
|
+
source = await loader(normalized);
|
|
232
|
+
} catch (error) {
|
|
233
|
+
errors.push({
|
|
234
|
+
mapPath: normalized,
|
|
235
|
+
code: "load-failed",
|
|
236
|
+
message: error instanceof Error ? error.message : String(error)
|
|
237
|
+
});
|
|
238
|
+
return null;
|
|
239
|
+
}
|
|
240
|
+
const parsed = parseTopicMap(source, normalized);
|
|
241
|
+
errors.push(...parsed.errors);
|
|
242
|
+
if (!parsed.map)
|
|
243
|
+
return null;
|
|
244
|
+
const resolveEntries = async (entries) => {
|
|
245
|
+
const out = [];
|
|
246
|
+
for (const entry of entries) {
|
|
247
|
+
const resolved = { ...entry };
|
|
248
|
+
if (resolved.navtitle !== void 0) {
|
|
249
|
+
resolved.navtitle = await renderValue(resolved.navtitle, variables, normalized, errors);
|
|
250
|
+
}
|
|
251
|
+
if (resolved.href !== void 0) {
|
|
252
|
+
const rendered = await renderValue(resolved.href, variables, normalized, errors);
|
|
253
|
+
resolved.href = resolveHref(rendered, normalized);
|
|
254
|
+
}
|
|
255
|
+
if (resolved.format === "topicmap" && resolved.href) {
|
|
256
|
+
const child = await loadMap(resolved.href, [...stack, normalized]);
|
|
257
|
+
if (child === null) {
|
|
258
|
+
continue;
|
|
259
|
+
}
|
|
260
|
+
const authored = resolved.topics ? await resolveEntries(resolved.topics) : [];
|
|
261
|
+
const mergedTopics = [...child.topics, ...authored];
|
|
262
|
+
const label = resolved.navtitle ?? child.title;
|
|
263
|
+
if (label !== void 0) {
|
|
264
|
+
out.push({
|
|
265
|
+
navtitle: label,
|
|
266
|
+
...resolved.toc !== void 0 && { toc: resolved.toc },
|
|
267
|
+
...resolved.singlePage !== void 0 && { singlePage: resolved.singlePage },
|
|
268
|
+
...resolved.meta !== void 0 && { meta: resolved.meta },
|
|
269
|
+
topics: mergedTopics
|
|
270
|
+
});
|
|
271
|
+
} else if (resolved.toc === false) {
|
|
272
|
+
out.push(...mergedTopics.map((topic) => ({ ...topic, toc: false })));
|
|
273
|
+
} else {
|
|
274
|
+
out.push(...mergedTopics);
|
|
275
|
+
}
|
|
276
|
+
continue;
|
|
277
|
+
}
|
|
278
|
+
if (resolved.topics) {
|
|
279
|
+
resolved.topics = await resolveEntries(resolved.topics);
|
|
280
|
+
}
|
|
281
|
+
out.push(resolved);
|
|
282
|
+
}
|
|
283
|
+
return out;
|
|
284
|
+
};
|
|
285
|
+
let title = parsed.map.title;
|
|
286
|
+
if (title !== void 0) {
|
|
287
|
+
title = await renderValue(title, variables, normalized, errors);
|
|
288
|
+
}
|
|
289
|
+
return {
|
|
290
|
+
...title !== void 0 && { title },
|
|
291
|
+
topics: await resolveEntries(parsed.map.topics)
|
|
292
|
+
};
|
|
293
|
+
};
|
|
294
|
+
const map = await loadMap(rootPath, []) ?? { topics: [] };
|
|
295
|
+
return { map, errors };
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
// node_modules/@dogsbay/format-topicmap/dist/nav-file.js
|
|
299
|
+
var isExternal = (href) => href.startsWith("/") || isExternalHref(href);
|
|
300
|
+
var labelFromHref = (href) => {
|
|
301
|
+
const base = href.split("/").pop() ?? href;
|
|
302
|
+
const stem = base.replace(/\.[^.]+$/, "");
|
|
303
|
+
const words = stem.replace(/[-_]+/g, " ").trim();
|
|
304
|
+
return words.length > 0 ? words[0].toUpperCase() + words.slice(1) : href;
|
|
305
|
+
};
|
|
306
|
+
var entryToNavFile = (entry) => {
|
|
307
|
+
if (entry.toc === false)
|
|
308
|
+
return null;
|
|
309
|
+
const label = entry.navtitle ?? (entry.href ? labelFromHref(entry.href) : void 0);
|
|
310
|
+
if (label === void 0)
|
|
311
|
+
return null;
|
|
312
|
+
const item = { label };
|
|
313
|
+
if (entry.href !== void 0) {
|
|
314
|
+
if (isExternal(entry.href)) {
|
|
315
|
+
item.href = entry.href;
|
|
316
|
+
} else {
|
|
317
|
+
item.file = entry.href;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
if (entry.singlePage !== void 0)
|
|
321
|
+
item.singlePage = entry.singlePage;
|
|
322
|
+
if (entry.topics && entry.topics.length > 0) {
|
|
323
|
+
const children = entry.topics.map(entryToNavFile).filter((child) => child !== null);
|
|
324
|
+
if (children.length > 0)
|
|
325
|
+
item.children = children;
|
|
326
|
+
}
|
|
327
|
+
if (item.file === void 0 && item.href === void 0 && item.children === void 0) {
|
|
328
|
+
return null;
|
|
329
|
+
}
|
|
330
|
+
return item;
|
|
331
|
+
};
|
|
332
|
+
var topicMapToNavFile = (map) => map.topics.map(entryToNavFile).filter((item) => item !== null);
|
|
333
|
+
|
|
334
|
+
// node_modules/@dogsbay/format-topicmap/dist/edit-source.js
|
|
335
|
+
var import_yaml = __toESM(require_dist(), 1);
|
|
336
|
+
|
|
337
|
+
// src/core/topicmap.ts
|
|
338
|
+
async function topicMapNav(mapPath, contentRoot, read, variables) {
|
|
339
|
+
const root = normalize(mapPath.replace(/^\.\//, ""));
|
|
340
|
+
const dir = dirname(root);
|
|
341
|
+
const at = (p) => dir ? `${dir}/${p}` : p;
|
|
342
|
+
const maps = [];
|
|
343
|
+
const result = await resolveTopicMap(root.slice(dir ? dir.length + 1 : 0), {
|
|
344
|
+
variables,
|
|
345
|
+
loader: async (p) => {
|
|
346
|
+
const path = normalize(at(p.replace(/^\/+/, "")));
|
|
347
|
+
if (path === ".." || path.startsWith("../") || dir && path !== dir && !path.startsWith(`${dir}/`)) {
|
|
348
|
+
throw new Error(`Refusing topic-map entry outside the map root: "${p}" resolves to ${path}, which is not inside ${dir || "the project"}`);
|
|
349
|
+
}
|
|
350
|
+
const text = await read(path);
|
|
351
|
+
if (text === void 0) throw new Error(`${path} does not exist`);
|
|
352
|
+
maps.push(path);
|
|
353
|
+
return text;
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
const errors = [...result.errors];
|
|
357
|
+
const rebase = (e) => {
|
|
358
|
+
const out = { ...e };
|
|
359
|
+
if (out.file !== void 0) {
|
|
360
|
+
const path = normalize(at(out.file));
|
|
361
|
+
const problem = path === contentRoot.replace(/\/$/, "") ? `"${e.file}" names the source content directory itself (${path || "the project"}): a nav entry names a page in it, such as ${path ? `${path}/` : ""}index.md` : path === ".." || path.startsWith("../") || !path.startsWith(contentRoot) ? `"${e.file}" resolves outside the source content directory (${path}): nav targets must live inside the source` : void 0;
|
|
362
|
+
if (problem) {
|
|
363
|
+
errors.push({ mapPath: root, code: "invalid-entry", message: problem });
|
|
364
|
+
delete out.file;
|
|
365
|
+
} else {
|
|
366
|
+
out.file = path.slice(contentRoot.length);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
if (out.children) out.children = out.children.map(rebase);
|
|
370
|
+
return out;
|
|
371
|
+
};
|
|
372
|
+
return { entries: topicMapToNavFile(result.map).map(rebase), maps, errors };
|
|
373
|
+
}
|
|
374
|
+
function topicMapError(mapPath, errors) {
|
|
375
|
+
const details = errors.map((e) => ` \u2717 [${e.code}] ${e.mapPath ? `${e.mapPath}: ` : ""}${e.message}`).join("\n");
|
|
376
|
+
return new Error(`Topic map ${mapPath} has ${errors.length} problem(s):
|
|
377
|
+
${details}
|
|
378
|
+
Fix the map or validate it with: dogsbay topicmap check ${mapPath}`);
|
|
379
|
+
}
|
|
380
|
+
export {
|
|
381
|
+
topicMapError,
|
|
382
|
+
topicMapNav
|
|
383
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
xml_default
|
|
5
|
+
} from "./chunk-JXM2XRAR.mjs";
|
|
6
|
+
import "./chunk-IAR2KPZC.mjs";
|
|
7
|
+
import "./chunk-STRHO6SY.mjs";
|
|
8
|
+
export {
|
|
9
|
+
xml_default as default
|
|
10
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
xml_default
|
|
5
|
+
} from "./chunk-JXM2XRAR.mjs";
|
|
6
|
+
import "./chunk-IAR2KPZC.mjs";
|
|
7
|
+
import "./chunk-STRHO6SY.mjs";
|
|
8
|
+
|
|
9
|
+
// node_modules/@shikijs/langs/dist/xsl.mjs
|
|
10
|
+
var lang = Object.freeze(JSON.parse(`{"displayName":"XSL","name":"xsl","patterns":[{"begin":"(<)(xsl)((:))(template)","captures":{"1":{"name":"punctuation.definition.tag.xml"},"2":{"name":"entity.name.tag.namespace.xml"},"3":{"name":"entity.name.tag.xml"},"4":{"name":"punctuation.separator.namespace.xml"},"5":{"name":"entity.name.tag.localname.xml"}},"end":"(>)","name":"meta.tag.xml.template","patterns":[{"captures":{"1":{"name":"entity.other.attribute-name.namespace.xml"},"2":{"name":"entity.other.attribute-name.xml"},"3":{"name":"punctuation.separator.namespace.xml"},"4":{"name":"entity.other.attribute-name.localname.xml"}},"match":" (?:([-0-9A-Z_a-z]+)((:)))?([-A-Za-z]+)"},{"include":"#doublequotedString"},{"include":"#singlequotedString"}]},{"include":"text.xml"}],"repository":{"doublequotedString":{"begin":"\\"","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.xml"}},"end":"\\"","endCaptures":{"0":{"name":"punctuation.definition.string.end.xml"}},"name":"string.quoted.double.xml"},"singlequotedString":{"begin":"'","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.xml"}},"end":"'","endCaptures":{"0":{"name":"punctuation.definition.string.end.xml"}},"name":"string.quoted.single.xml"}},"scopeName":"text.xml.xsl","embeddedLangs":["xml"]}`));
|
|
11
|
+
var xsl_default = [
|
|
12
|
+
...xml_default,
|
|
13
|
+
lang
|
|
14
|
+
];
|
|
15
|
+
export {
|
|
16
|
+
xsl_default as default
|
|
17
|
+
};
|
package/cli.mjs
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
BUILD_USAGE,
|
|
5
|
+
UsageError,
|
|
6
|
+
flag,
|
|
7
|
+
option,
|
|
8
|
+
positional,
|
|
9
|
+
wantsHelp
|
|
10
|
+
} from "./chunks/chunk-LNWQN7K7.mjs";
|
|
11
|
+
import "./chunks/chunk-STRHO6SY.mjs";
|
|
12
|
+
|
|
13
|
+
// src/node/cli.ts
|
|
14
|
+
import { resolve } from "node:path";
|
|
15
|
+
var HIGHLIGHT_WORKER = new URL("./highlight-worker.mjs", import.meta.url);
|
|
16
|
+
var USAGE = {
|
|
17
|
+
build: BUILD_USAGE,
|
|
18
|
+
assemble: "assemble [project] [-o site] [--quiet]",
|
|
19
|
+
check: "check [project] [--json] [--strict] [--source|--dist] [--category <c>] [--rule <id>] [--skip <id>] [--include-drafts] [--untrusted] [--low-memory] [--no-diagrams] [--quiet]",
|
|
20
|
+
"release-diff": "release-diff [project] [--from <version>] [--json] [--write] [--candidates] [--strict] [--git-from <ref>]",
|
|
21
|
+
dev: "dev [project] [-p port] [--lazy] [--no-search] [--llms] [--no-diagrams]",
|
|
22
|
+
serve: "serve [dir] [-p port]",
|
|
23
|
+
publish: "publish [project] --worker <url> --site <name> [--part-mb 80] [--unit <prefix>]... [--pretty] [--no-search] [--no-diagrams] [--include-drafts] [--dry-run] (token in SSG_TOKEN)"
|
|
24
|
+
};
|
|
25
|
+
function usage(code = 0, cmd2) {
|
|
26
|
+
const lines = cmd2 && Object.hasOwn(USAGE, cmd2) ? [USAGE[cmd2]] : Object.values(USAGE);
|
|
27
|
+
console.log(lines.map((l) => `dogsbay-ssg ${l}`).join("\n"));
|
|
28
|
+
process.exit(code);
|
|
29
|
+
}
|
|
30
|
+
var cmd;
|
|
31
|
+
async function main() {
|
|
32
|
+
const args = process.argv.slice(2);
|
|
33
|
+
cmd = args.shift();
|
|
34
|
+
if (!cmd || cmd === "-h" || cmd === "--help") usage();
|
|
35
|
+
if (!Object.hasOwn(USAGE, cmd)) {
|
|
36
|
+
console.error(`unknown command: ${cmd}`);
|
|
37
|
+
usage(1);
|
|
38
|
+
}
|
|
39
|
+
if (wantsHelp(args)) usage(0, cmd);
|
|
40
|
+
if (cmd === "build") return (await import("./chunks/build-command-WQJANVGR.mjs")).runBuild(args, HIGHLIGHT_WORKER);
|
|
41
|
+
if (cmd === "assemble") return (await import("./chunks/build-command-WQJANVGR.mjs")).runBuild(args, HIGHLIGHT_WORKER, { assemble: true });
|
|
42
|
+
if (cmd === "check") return (await import("./chunks/check-command-QTJ6BUNL.mjs")).runCheck(args);
|
|
43
|
+
if (cmd === "publish") return (await import("./chunks/publish-command-J7KGJTLD.mjs")).runPublish(args);
|
|
44
|
+
if (cmd === "release-diff") {
|
|
45
|
+
const from = option(args, "--from")[0];
|
|
46
|
+
const gitFrom = option(args, "--git-from")[0];
|
|
47
|
+
const o = { from, gitFrom, json: flag(args, "--json"), write: flag(args, "--write"), candidates: flag(args, "--candidates"), strict: flag(args, "--strict") };
|
|
48
|
+
const project = resolve(positional(args, "."));
|
|
49
|
+
const { runReleaseDiff } = await import("./chunks/release-diff-JMNCG2T7.mjs");
|
|
50
|
+
process.exitCode = await runReleaseDiff(project, o);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (cmd === "dev") {
|
|
54
|
+
const port = Number(option(args, "-p", "--port")[0] ?? 4400);
|
|
55
|
+
const noDiagrams = flag(args, "--no-diagrams");
|
|
56
|
+
const lazy = flag(args, "--lazy");
|
|
57
|
+
const noSearchDev = flag(args, "--no-search");
|
|
58
|
+
const llms = flag(args, "--llms");
|
|
59
|
+
const project = resolve(positional(args, "."));
|
|
60
|
+
const t0 = performance.now();
|
|
61
|
+
const { dev, readyLine, serverUrl } = await import("./chunks/dev-X3Y5P4KI.mjs");
|
|
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
|
+
console.log(`dev server for ${project} at ${serverUrl(server)} (ready in ${Math.round(performance.now() - t0)} ms); watching for changes`);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (cmd === "serve") {
|
|
67
|
+
const port = Number(option(args, "-p", "--port")[0] ?? 4400);
|
|
68
|
+
const dir = resolve(positional(args, "out"));
|
|
69
|
+
const { serve } = await import("./chunks/serve-CUWABTUV.mjs");
|
|
70
|
+
await serve(dir, port);
|
|
71
|
+
console.log(`serving ${dir} at http://127.0.0.1:${port}/`);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
usage(1);
|
|
75
|
+
}
|
|
76
|
+
main().catch((e) => {
|
|
77
|
+
if (e instanceof UsageError) {
|
|
78
|
+
if (e.message) console.error(e.message);
|
|
79
|
+
usage(1, cmd);
|
|
80
|
+
}
|
|
81
|
+
console.error(e instanceof Error ? e.message : e);
|
|
82
|
+
process.exit(1);
|
|
83
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
createHighlighter
|
|
5
|
+
} from "./chunks/chunk-UKZGJ5AP.mjs";
|
|
6
|
+
import "./chunks/chunk-YVSP26OS.mjs";
|
|
7
|
+
import "./chunks/chunk-G6OTOD3B.mjs";
|
|
8
|
+
import "./chunks/chunk-STRHO6SY.mjs";
|
|
9
|
+
|
|
10
|
+
// src/node/highlight-worker.ts
|
|
11
|
+
import { parentPort } from "node:worker_threads";
|
|
12
|
+
var hl = await createHighlighter({ cacheChars: 0 });
|
|
13
|
+
parentPort.on("message", async ({ id, blocks }) => {
|
|
14
|
+
try {
|
|
15
|
+
await hl.load(blocks);
|
|
16
|
+
parentPort.postMessage({ id, html: blocks.map((b) => hl.render(b.code, b.lang, b.opts)) });
|
|
17
|
+
} catch (e) {
|
|
18
|
+
parentPort.postMessage({ id, error: e.message });
|
|
19
|
+
}
|
|
20
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dogsbay/ssg-cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "0.2.0-beta.167.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "The dogsbay-ssg command: build, check, preview and publish Dogsbay-MD documentation sites that work offline",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"bin": {
|
|
8
|
+
"dogsbay-ssg": "cli.mjs"
|
|
9
|
+
},
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">=20"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"cli.mjs",
|
|
15
|
+
"highlight-worker.mjs",
|
|
16
|
+
"chunks",
|
|
17
|
+
"THIRD-PARTY-NOTICES.txt",
|
|
18
|
+
"NOTICE"
|
|
19
|
+
],
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@dogsbay/icons": "0.2.0-beta.167",
|
|
22
|
+
"@mermanjs/web-render": "0.9.3"
|
|
23
|
+
},
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
}
|
|
27
|
+
}
|