saturndocs 0.5.1 → 0.7.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/dist/auth-76SYM7IA.js +17 -0
- package/dist/broken-links-E4GALBEW.js +50 -0
- package/dist/{build-MHVOQFLW.js → build-SSRHSDDN.js} +18 -7
- package/dist/check-YVUYIH3Y.js +160 -0
- package/dist/{chunk-MRM7F2AG.js → chunk-2G4DQ7MR.js} +8 -6
- package/dist/{chunk-5UES2U73.js → chunk-2QAM6CSJ.js} +2 -2
- package/dist/{chunk-TFUZHZYD.js → chunk-2XGQJ6O5.js} +18 -6
- package/dist/{chunk-5MPSOIDR.js → chunk-3XZBGNY4.js} +12 -10
- package/dist/chunk-6LD7SPWQ.js +79 -0
- package/dist/{chunk-GZWCWTWW.js → chunk-74RXKLCM.js} +36 -13
- package/dist/{renderer-76D7VFQ3.js → chunk-D5WG63T5.js} +2 -1
- package/dist/{chunk-VAQXCTVC.js → chunk-E5LB2OL7.js} +9 -7
- package/dist/chunk-FNPG5423.js +192 -0
- package/dist/{chunk-M2BZEDAS.js → chunk-FNZJHYAX.js} +2 -1
- package/dist/{chunk-EG5W7EGK.js → chunk-FTRNX643.js} +27 -10
- package/dist/{chunk-ZNLLNDCO.js → chunk-HWAQ2YEK.js} +70 -47
- package/dist/{chunk-KBVOLS2Y.js → chunk-N5W667O7.js} +59 -12
- package/dist/{chunk-K5VTXKBR.js → chunk-O7FL4UDY.js} +10 -8
- package/dist/{chunk-73NLPKNN.js → chunk-OCDPAWTL.js} +28 -187
- package/dist/{chunk-OWKBGNGZ.js → chunk-QSJHJKJP.js} +18 -0
- package/dist/{chunk-5USJZ6NW.js → chunk-SNXQSHWR.js} +11 -9
- package/dist/chunk-STUQD2NY.js +21 -0
- package/dist/{broken-links-4AGMC2MO.js → chunk-SVRGZWBQ.js} +132 -38
- package/dist/{chunk-E4GSFRKL.js → chunk-VWPXQFHD.js} +33 -11
- package/dist/{chunk-KTQKLRHK.js → chunk-WBMWO34R.js} +12 -10
- package/dist/{chunk-76LHDHYT.js → chunk-WKRDJOFJ.js} +14 -12
- package/dist/{chunk-NYNPT2QB.js → chunk-X2HK6HRK.js} +12 -10
- package/dist/chunk-XBDKZGCA.js +109 -0
- package/dist/{chunk-IKQ7AGQF.js → chunk-Y6X7O2RH.js} +11 -4
- package/dist/{chunk-4Y6MLUWG.js → chunk-YFET6FIO.js} +8 -6
- package/dist/{chunk-YT6RV4YV.js → chunk-YOXZMP5Z.js} +4 -2
- package/dist/{chunk-DEHR3XUP.js → chunk-YP6IRZZV.js} +2 -2
- package/dist/{chunk-6YU3R6KT.js → chunk-YXS34FS2.js} +10 -1
- package/dist/{chunk-APABCEY4.js → chunk-Z2CENESG.js} +10 -8
- package/dist/cli.js +18 -8
- package/dist/coverage-XQU3PEAH.js +16 -0
- package/dist/{dev-QPQMWQQS.js → dev-G24A7FEQ.js} +59 -12
- package/dist/{dist-HWVPEW6T.js → dist-GONQDTBT.js} +4 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +53 -51
- package/dist/init-O4R3LDNE.js +18 -0
- package/dist/{lint-UXAQS37W.js → lint-XQQEHOHB.js} +4 -3
- package/dist/local-metadata-5KLCOASW.js +19 -0
- package/dist/{login-PYPRPZKQ.js → login-ZE257BGZ.js} +6 -5
- package/dist/manage-25YZ3NEO.js +17 -0
- package/dist/nav-35UUYP45.js +15 -0
- package/dist/{openapiCheck-IUYQOHOT.js → openapiCheck-HLWOQZKQ.js} +23 -22
- package/dist/pages-ZUAODNC6.js +17 -0
- package/dist/{read-OIAJVVWF.js → read-KXU34B5I.js} +13 -11
- package/dist/{read-5JX2VT5I.js → read-NA76WCIK.js} +14 -12
- package/dist/renderer-LKTT533L.js +12 -0
- package/dist/requests-326KNATQ.js +14 -0
- package/dist/schema-IGC5XO4E.js +14 -0
- package/dist/sites-ECFP6IMI.js +16 -0
- package/dist/status-3UNBNX4X.js +15 -0
- package/dist/{suggestions-3WG7NIQQ.js → suggestions-4PE6SHVW.js} +14 -12
- package/dist/validate-PMTH2ICX.js +15 -0
- package/package.json +6 -6
- package/dist/auth-3MLMF5Q3.js +0 -16
- package/dist/chunk-AJ2ZMY42.js +0 -62
- package/dist/coverage-N6W4AASU.js +0 -15
- package/dist/init-HAGN6VFO.js +0 -15
- package/dist/manage-WI3VBXEU.js +0 -16
- package/dist/nav-OGQ6A4T6.js +0 -14
- package/dist/pages-KNXVBA6S.js +0 -16
- package/dist/requests-HBN7JHUH.js +0 -13
- package/dist/schema-Q7AE5RAW.js +0 -13
- package/dist/sites-J6VTPRTR.js +0 -15
- package/dist/status-YB26LFPN.js +0 -14
- package/dist/validate-JVRDLMND.js +0 -12
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AUTH_METADATA,
|
|
3
|
+
authStatusOf,
|
|
4
|
+
registerAuth,
|
|
5
|
+
savedLoginStatusOf
|
|
6
|
+
} from "./chunk-E5LB2OL7.js";
|
|
7
|
+
import "./chunk-2XGQJ6O5.js";
|
|
8
|
+
import "./chunk-YOXZMP5Z.js";
|
|
9
|
+
import "./chunk-FNZJHYAX.js";
|
|
10
|
+
import "./chunk-FNPG5423.js";
|
|
11
|
+
import "./chunk-OCDPAWTL.js";
|
|
12
|
+
export {
|
|
13
|
+
AUTH_METADATA,
|
|
14
|
+
authStatusOf,
|
|
15
|
+
registerAuth,
|
|
16
|
+
savedLoginStatusOf
|
|
17
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import {
|
|
2
|
+
checkLinks
|
|
3
|
+
} from "./chunk-SVRGZWBQ.js";
|
|
4
|
+
import "./chunk-QSJHJKJP.js";
|
|
5
|
+
import "./chunk-YP6IRZZV.js";
|
|
6
|
+
import "./chunk-74RXKLCM.js";
|
|
7
|
+
import {
|
|
8
|
+
requireDocsDir
|
|
9
|
+
} from "./chunk-STUQD2NY.js";
|
|
10
|
+
import "./chunk-N5W667O7.js";
|
|
11
|
+
import "./chunk-HWAQ2YEK.js";
|
|
12
|
+
import "./chunk-YXS34FS2.js";
|
|
13
|
+
import {
|
|
14
|
+
applyCommandHelp
|
|
15
|
+
} from "./chunk-FNZJHYAX.js";
|
|
16
|
+
import {
|
|
17
|
+
createResultWriter,
|
|
18
|
+
failureResult,
|
|
19
|
+
invalidInput,
|
|
20
|
+
resolveGlobalOptions,
|
|
21
|
+
successResult
|
|
22
|
+
} from "./chunk-FNPG5423.js";
|
|
23
|
+
import {
|
|
24
|
+
BROKEN_LINKS_METADATA
|
|
25
|
+
} from "./chunk-XBDKZGCA.js";
|
|
26
|
+
import "./chunk-OCDPAWTL.js";
|
|
27
|
+
|
|
28
|
+
// src/commands/broken-links.ts
|
|
29
|
+
function linkLine(d) {
|
|
30
|
+
const place = d.line === null ? d.file : `${d.file}:${d.line}:${d.column}`;
|
|
31
|
+
return `${place}: ${d.link} \u2014 ${d.reason}${d.occurrences > 1 ? ` (on ${d.occurrences} rendered pages, first ${d.rendered})` : ""}`;
|
|
32
|
+
}
|
|
33
|
+
function registerBrokenLinks(program, provide, cache) {
|
|
34
|
+
const command = program.command("broken-links [docs-dir]").option("--site-url <url>", "Override the production site URL.").action(async (dir, options, self) => {
|
|
35
|
+
const writer = createResultWriter({ json: resolveGlobalOptions(self).json });
|
|
36
|
+
const context = { command: "broken-links", siteId: null };
|
|
37
|
+
try {
|
|
38
|
+
const report = await checkLinks(requireDocsDir(dir), cache, provide, options.siteUrl);
|
|
39
|
+
if (report.diagnostics.length) throw invalidInput(report.diagnostics.map(linkLine).join("\n"), { data: report });
|
|
40
|
+
process.exitCode = writer.write(successResult(context, report), { text: "Author preview has no broken internal links." });
|
|
41
|
+
} catch (error) {
|
|
42
|
+
process.exitCode = writer.write(failureResult(error, context));
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
applyCommandHelp(command, BROKEN_LINKS_METADATA[0]);
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
linkLine,
|
|
49
|
+
registerBrokenLinks
|
|
50
|
+
};
|
|
@@ -3,16 +3,26 @@ import {
|
|
|
3
3
|
} from "./chunk-LDE53VKA.js";
|
|
4
4
|
import {
|
|
5
5
|
buildGeneration
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
} from "./chunk-74RXKLCM.js";
|
|
7
|
+
import {
|
|
8
|
+
requireDocsDir
|
|
9
|
+
} from "./chunk-STUQD2NY.js";
|
|
10
|
+
import "./chunk-N5W667O7.js";
|
|
11
|
+
import "./chunk-HWAQ2YEK.js";
|
|
12
|
+
import "./chunk-YXS34FS2.js";
|
|
13
|
+
import {
|
|
14
|
+
applyCommandHelp
|
|
15
|
+
} from "./chunk-FNZJHYAX.js";
|
|
10
16
|
import {
|
|
11
17
|
createResultWriter,
|
|
12
18
|
failureResult,
|
|
13
19
|
resolveGlobalOptions,
|
|
14
20
|
successResult
|
|
15
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-FNPG5423.js";
|
|
22
|
+
import {
|
|
23
|
+
BUILD_METADATA
|
|
24
|
+
} from "./chunk-XBDKZGCA.js";
|
|
25
|
+
import "./chunk-OCDPAWTL.js";
|
|
16
26
|
|
|
17
27
|
// src/lib/preview/output.ts
|
|
18
28
|
import { createHash, randomUUID } from "crypto";
|
|
@@ -121,11 +131,11 @@ async function exportBuild(docsDir, outDir, siteUrl, cacheDir, provide) {
|
|
|
121
131
|
|
|
122
132
|
// src/commands/build.ts
|
|
123
133
|
function registerBuild(program, provider, cache) {
|
|
124
|
-
program.command("build [docs-dir]").requiredOption("--out-dir <path>").option("--site-url <url>", "Site URL", "http://localhost").action(async (dir, options, self) => {
|
|
134
|
+
const command = program.command("build [docs-dir]").requiredOption("--out-dir <path>", "Directory for the static site. It must be outside the docs directory.").option("--site-url <url>", "Site URL to render against.", "http://localhost").action(async (dir, options, self) => {
|
|
125
135
|
const writer = createResultWriter({ json: resolveGlobalOptions(self).json });
|
|
126
136
|
const context = { command: "build", siteId: null };
|
|
127
137
|
try {
|
|
128
|
-
const report = await exportBuild(dir
|
|
138
|
+
const report = await exportBuild(requireDocsDir(dir), options.outDir, options.siteUrl, cache, provider);
|
|
129
139
|
process.exitCode = writer.write(successResult(context, report), {
|
|
130
140
|
text: [`Built author preview at ${report.output_path}`, ...report.warnings].join("\n")
|
|
131
141
|
});
|
|
@@ -133,6 +143,7 @@ function registerBuild(program, provider, cache) {
|
|
|
133
143
|
process.exitCode = writer.write(failureResult(error, context));
|
|
134
144
|
}
|
|
135
145
|
});
|
|
146
|
+
applyCommandHelp(command, BUILD_METADATA[0]);
|
|
136
147
|
}
|
|
137
148
|
export {
|
|
138
149
|
registerBuild
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import {
|
|
2
|
+
checkLinks
|
|
3
|
+
} from "./chunk-SVRGZWBQ.js";
|
|
4
|
+
import "./chunk-QSJHJKJP.js";
|
|
5
|
+
import "./chunk-D5WG63T5.js";
|
|
6
|
+
import {
|
|
7
|
+
RendererError
|
|
8
|
+
} from "./chunk-LDE53VKA.js";
|
|
9
|
+
import {
|
|
10
|
+
lintDocsDir
|
|
11
|
+
} from "./chunk-FTRNX643.js";
|
|
12
|
+
import "./chunk-YGVC4N4V.js";
|
|
13
|
+
import "./chunk-YP6IRZZV.js";
|
|
14
|
+
import "./chunk-74RXKLCM.js";
|
|
15
|
+
import {
|
|
16
|
+
requireDocsDir
|
|
17
|
+
} from "./chunk-STUQD2NY.js";
|
|
18
|
+
import {
|
|
19
|
+
validateDocsDetailed
|
|
20
|
+
} from "./chunk-N5W667O7.js";
|
|
21
|
+
import "./chunk-HWAQ2YEK.js";
|
|
22
|
+
import "./chunk-YXS34FS2.js";
|
|
23
|
+
import {
|
|
24
|
+
applyCommandHelp
|
|
25
|
+
} from "./chunk-FNZJHYAX.js";
|
|
26
|
+
import {
|
|
27
|
+
CliError,
|
|
28
|
+
createResultWriter,
|
|
29
|
+
failureResult,
|
|
30
|
+
invalidInput,
|
|
31
|
+
resolveGlobalOptions,
|
|
32
|
+
successResult
|
|
33
|
+
} from "./chunk-FNPG5423.js";
|
|
34
|
+
import {
|
|
35
|
+
CHECK_METADATA
|
|
36
|
+
} from "./chunk-XBDKZGCA.js";
|
|
37
|
+
import "./chunk-OCDPAWTL.js";
|
|
38
|
+
|
|
39
|
+
// src/commands/check.ts
|
|
40
|
+
var MISSING_ANCHOR = "No element with this id on the target page";
|
|
41
|
+
var LINK_FIX = "Link to a page in docs.json navigation, a file under public/, a docs.json redirect source, or a full URL.";
|
|
42
|
+
var ANCHOR_FIX = "Use the id of a heading on the target page. A heading's id is its text in lower case, with a hyphen for each space.";
|
|
43
|
+
function fromIssue(issue, severity) {
|
|
44
|
+
return { check: "validate", severity, path: issue.path, line: issue.line, column: issue.column, rule: issue.code, message: issue.message, fix: issue.fix };
|
|
45
|
+
}
|
|
46
|
+
function fromLink(link) {
|
|
47
|
+
const anchor = link.reason === MISSING_ANCHOR;
|
|
48
|
+
const count = link.occurrences > 1 ? ` It is on ${link.occurrences} rendered pages; the first is ${link.rendered}.` : "";
|
|
49
|
+
return {
|
|
50
|
+
check: "links",
|
|
51
|
+
severity: "error",
|
|
52
|
+
path: link.file,
|
|
53
|
+
line: link.line,
|
|
54
|
+
column: link.column,
|
|
55
|
+
rule: anchor ? "missing_anchor" : "broken_link",
|
|
56
|
+
message: `link to ${link.link} does not resolve: ${link.reason}.${count}`,
|
|
57
|
+
fix: anchor ? ANCHOR_FIX : LINK_FIX
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
var placeKey = (finding) => `${finding.path}\0${finding.line}\0${finding.column}\0${finding.rule}`;
|
|
61
|
+
function ordered(findings) {
|
|
62
|
+
return findings.map((finding, index) => ({ finding, index })).sort((left, right) => {
|
|
63
|
+
const a = left.finding;
|
|
64
|
+
const b = right.finding;
|
|
65
|
+
if (a.path !== b.path) return a.path === null ? 1 : b.path === null ? -1 : a.path < b.path ? -1 : 1;
|
|
66
|
+
const line = (a.line ?? Number.MAX_SAFE_INTEGER) - (b.line ?? Number.MAX_SAFE_INTEGER);
|
|
67
|
+
if (line !== 0) return line;
|
|
68
|
+
const column = (a.column ?? 0) - (b.column ?? 0);
|
|
69
|
+
return column !== 0 ? column : left.index - right.index;
|
|
70
|
+
}).map((entry) => entry.finding);
|
|
71
|
+
}
|
|
72
|
+
async function checkDocs(docsDir, options) {
|
|
73
|
+
const limitations = [];
|
|
74
|
+
const validation = await validateDocsDetailed(docsDir);
|
|
75
|
+
let findings = [
|
|
76
|
+
...validation.errors.map((issue) => fromIssue(issue, "error")),
|
|
77
|
+
...validation.warnings.map((issue) => fromIssue(issue, "warning"))
|
|
78
|
+
];
|
|
79
|
+
const seen = new Set(findings.map(placeKey));
|
|
80
|
+
const lint = await lintDocsDir(docsDir);
|
|
81
|
+
for (const found of lint.findings) {
|
|
82
|
+
const finding = {
|
|
83
|
+
check: "lint",
|
|
84
|
+
severity: found.severity,
|
|
85
|
+
path: found.path === "" ? null : found.path,
|
|
86
|
+
line: found.line,
|
|
87
|
+
column: found.column ?? null,
|
|
88
|
+
rule: found.rule,
|
|
89
|
+
message: found.message,
|
|
90
|
+
fix: found.fix ?? null
|
|
91
|
+
};
|
|
92
|
+
if (seen.has(placeKey(finding)) || seen.has(placeKey({ ...finding, column: null }))) continue;
|
|
93
|
+
findings.push(finding);
|
|
94
|
+
}
|
|
95
|
+
const failed = (check) => findings.some((finding) => finding.check === check && finding.severity === "error");
|
|
96
|
+
const checks = { validate: failed("validate") ? "failed" : "passed", lint: failed("lint") ? "failed" : "passed", links: "skipped" };
|
|
97
|
+
const unbuildable = validation.errors.some((issue) => issue.code !== "unresolved_link");
|
|
98
|
+
const without = (message, state) => {
|
|
99
|
+
checks.links = state;
|
|
100
|
+
limitations.push({ code: "section_unavailable", at: "checks.links", message });
|
|
101
|
+
};
|
|
102
|
+
if (!options.links) {
|
|
103
|
+
without("The rendered link and fragment check did not run, because --skip-links was passed.", "skipped");
|
|
104
|
+
} else if (unbuildable) {
|
|
105
|
+
without("The rendered link and fragment check did not run, because the site does not build until the errors are fixed. Fix them and run check again.", "skipped");
|
|
106
|
+
} else {
|
|
107
|
+
try {
|
|
108
|
+
const rendered = await checkLinks(docsDir, options.cache, options.provide, options.siteUrl);
|
|
109
|
+
findings = findings.filter((finding) => finding.rule !== "unresolved_link");
|
|
110
|
+
findings.push(...rendered.diagnostics.map(fromLink));
|
|
111
|
+
checks.links = rendered.diagnostics.length > 0 ? "failed" : "passed";
|
|
112
|
+
checks.validate = failed("validate") ? "failed" : "passed";
|
|
113
|
+
} catch (error) {
|
|
114
|
+
const issues = error instanceof CliError && error.code === "invalid_input" ? error.data?.errors : void 0;
|
|
115
|
+
if (error instanceof RendererError || issues?.every((issue) => issue.code === "preview_unsupported")) {
|
|
116
|
+
without(`The rendered link and fragment check did not run: ${error.message.split("\n")[0]}`, "unavailable");
|
|
117
|
+
} else if (issues !== void 0) {
|
|
118
|
+
findings.push(...issues.map((issue) => ({ ...fromIssue(issue, "error"), check: "links" })));
|
|
119
|
+
checks.links = "failed";
|
|
120
|
+
} else {
|
|
121
|
+
throw error;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
findings = ordered(findings);
|
|
126
|
+
const errors = findings.filter((finding) => finding.severity === "error").length;
|
|
127
|
+
return {
|
|
128
|
+
report: { docs_dir: docsDir, passed: errors === 0, errors, warnings: findings.length - errors, checks, findings },
|
|
129
|
+
limitations
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
function checkReportText(report) {
|
|
133
|
+
const lines = report.findings.flatMap((finding) => {
|
|
134
|
+
const place = finding.path === null ? "bundle" : finding.line === null ? finding.path : finding.column === null ? `${finding.path}:${finding.line}` : `${finding.path}:${finding.line}:${finding.column}`;
|
|
135
|
+
const head = `${place} ${finding.severity} ${finding.rule} (${finding.check}): ${finding.message}`;
|
|
136
|
+
return finding.fix === null ? [head] : [head, ` fix: ${finding.fix}`];
|
|
137
|
+
});
|
|
138
|
+
const states = ["validate", "lint", "links"].map((check) => `${check} ${report.checks[check]}`).join(", ");
|
|
139
|
+
lines.push(`${report.passed ? "\u2713" : "\u2716"} ${report.errors} error(s) and ${report.warnings} warning(s) in ${report.docs_dir}: ${states}.`);
|
|
140
|
+
return lines.join("\n");
|
|
141
|
+
}
|
|
142
|
+
function registerCheck(program, provide, cache) {
|
|
143
|
+
const command = program.command("check").argument("[dir]", "The docs directory. Defaults to the current directory.").option("--skip-links", "Skip the rendered link and fragment check, which builds the site.").option("--site-url <url>", "Override the production site URL for the link check.").action(async (dir, options, self) => {
|
|
144
|
+
const writer = createResultWriter({ json: resolveGlobalOptions(self).json });
|
|
145
|
+
const context = { command: "check", siteId: null };
|
|
146
|
+
try {
|
|
147
|
+
const { report, limitations } = await checkDocs(requireDocsDir(dir), { links: options.skipLinks !== true, siteUrl: options.siteUrl, cache, provide });
|
|
148
|
+
if (!report.passed) throw invalidInput(checkReportText(report), { data: report, limitations });
|
|
149
|
+
process.exitCode = writer.write(successResult({ ...context, limitations }, report), { text: checkReportText(report) });
|
|
150
|
+
} catch (error) {
|
|
151
|
+
process.exitCode = writer.write(failureResult(error, context));
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
applyCommandHelp(command, CHECK_METADATA[0]);
|
|
155
|
+
}
|
|
156
|
+
export {
|
|
157
|
+
checkDocs,
|
|
158
|
+
checkReportText,
|
|
159
|
+
registerCheck
|
|
160
|
+
};
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
asCliError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-2XGQJ6O5.js";
|
|
4
4
|
import {
|
|
5
5
|
applyCommandHelp
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-FNZJHYAX.js";
|
|
7
7
|
import {
|
|
8
|
-
commandMetadata,
|
|
9
8
|
createResultWriter,
|
|
10
9
|
failureResult,
|
|
11
|
-
|
|
10
|
+
invalidInput,
|
|
12
11
|
messageOf,
|
|
13
12
|
resolveGlobalOptions,
|
|
14
13
|
successResult
|
|
15
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-FNPG5423.js";
|
|
15
|
+
import {
|
|
16
|
+
commandMetadata
|
|
17
|
+
} from "./chunk-OCDPAWTL.js";
|
|
16
18
|
|
|
17
19
|
// src/commands/nav.ts
|
|
18
20
|
import { existsSync } from "fs";
|
|
@@ -45,7 +47,7 @@ async function readJson(path, label) {
|
|
|
45
47
|
}
|
|
46
48
|
}
|
|
47
49
|
async function applyOutlineNavigation(docsDir, outlinePath) {
|
|
48
|
-
const { parseOutline, navigationFromOutline } = await import("./dist-
|
|
50
|
+
const { parseOutline, navigationFromOutline } = await import("./dist-GONQDTBT.js");
|
|
49
51
|
const docsPath = resolve(docsDir, "docs.json");
|
|
50
52
|
if (!existsSync(docsPath)) throw invalidInput(`No docs.json found in ${docsDir}. Pass a docs directory.`);
|
|
51
53
|
const config = await readJson(docsPath, "docs.json");
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
interruptSignal
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-YOXZMP5Z.js";
|
|
4
4
|
import {
|
|
5
5
|
CliError,
|
|
6
|
-
createClient,
|
|
7
6
|
interrupted,
|
|
8
|
-
|
|
7
|
+
invalidInput
|
|
8
|
+
} from "./chunk-FNPG5423.js";
|
|
9
|
+
import {
|
|
10
|
+
createClient,
|
|
9
11
|
isManagementError,
|
|
10
12
|
parseOrigin
|
|
11
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-OCDPAWTL.js";
|
|
12
14
|
|
|
13
15
|
// src/lib/credentials.ts
|
|
14
16
|
import { execFile } from "child_process";
|
|
@@ -770,6 +772,13 @@ function loginAgainRecovery(site) {
|
|
|
770
772
|
message: `Ask the person to approve this agent for ${site} again.`
|
|
771
773
|
};
|
|
772
774
|
}
|
|
775
|
+
function savedLoginRefusalRecovery(site) {
|
|
776
|
+
return {
|
|
777
|
+
command: `saturndocs auth status --site ${site}`,
|
|
778
|
+
replay: null,
|
|
779
|
+
message: `Read the permissions of this login. To add one, run saturndocs login --site ${site} --scope with the permissions you need. A command that no saved login can run needs SATURNDOCS_MANAGEMENT_TOKEN, a management credential that a site owner issues in the dashboard.`
|
|
780
|
+
};
|
|
781
|
+
}
|
|
773
782
|
function withoutGrant(record, site) {
|
|
774
783
|
const grants = { ...record.grants };
|
|
775
784
|
delete grants[site];
|
|
@@ -873,13 +882,16 @@ function clientFor(globals, environment = {}) {
|
|
|
873
882
|
function asCliError(error) {
|
|
874
883
|
if (!isManagementError(error)) return error;
|
|
875
884
|
const refused = error.detail.code === "unauthorized" || error.detail.code === "forbidden";
|
|
876
|
-
|
|
885
|
+
const betaOff = error.detail.server?.code === "authoring_beta_off";
|
|
886
|
+
const savedRefusal = refused && savedLoginSite !== null && !betaOff && error.recovery == null;
|
|
887
|
+
const message = savedRefusal ? `The server refused the saved login for ${savedLoginSite}. Either the login lacks the permission that this command needs, or the command needs a management credential.` : error.detail.message;
|
|
888
|
+
return new CliError(error.detail.code, message, {
|
|
877
889
|
server: error.detail.server,
|
|
878
890
|
retryable: error.detail.retryable,
|
|
879
891
|
mutation: error.detail.mutation,
|
|
880
892
|
exit: error.detail.exit,
|
|
881
893
|
cause: error,
|
|
882
|
-
recovery:
|
|
894
|
+
recovery: betaOff ? { command: null, replay: null, message: "Agent authoring is in beta for this site. Contact SaturnDocs to turn it on." } : savedRefusal ? savedLoginRefusalRecovery(savedLoginSite) : error.recovery ?? null
|
|
883
895
|
});
|
|
884
896
|
}
|
|
885
897
|
|
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SITES_CREATE_METADATA,
|
|
3
3
|
registerSitesCreate
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-YFET6FIO.js";
|
|
5
5
|
import {
|
|
6
6
|
asCliError,
|
|
7
7
|
clientFor
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-2XGQJ6O5.js";
|
|
9
9
|
import {
|
|
10
10
|
applyCommandHelp
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-FNZJHYAX.js";
|
|
12
12
|
import {
|
|
13
|
-
commandMetadata,
|
|
14
13
|
createResultWriter,
|
|
15
14
|
failureResult,
|
|
15
|
+
invalidInput,
|
|
16
|
+
resolveGlobalOptions,
|
|
17
|
+
successResult
|
|
18
|
+
} from "./chunk-FNPG5423.js";
|
|
19
|
+
import {
|
|
20
|
+
commandMetadata,
|
|
16
21
|
grantFields,
|
|
17
22
|
grantLimitation,
|
|
18
|
-
invalidInput2 as invalidInput,
|
|
19
23
|
listSites,
|
|
20
24
|
readSiteDetail,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
successResult
|
|
24
|
-
} from "./chunk-73NLPKNN.js";
|
|
25
|
+
resolveTarget
|
|
26
|
+
} from "./chunk-OCDPAWTL.js";
|
|
25
27
|
|
|
26
28
|
// src/commands/sites.ts
|
|
27
29
|
var SITES_METADATA = Object.freeze([
|
|
@@ -63,7 +65,7 @@ function requestedSite(positional, flag) {
|
|
|
63
65
|
}
|
|
64
66
|
function listText(discovery) {
|
|
65
67
|
const lines = discovery.sites.map((site) => `${site.site_id}${site.site_id === discovery.current ? " (current)" : ""} ${site.primary_host ?? "no primary host returned"}`);
|
|
66
|
-
return [...lines, "A
|
|
68
|
+
return [...lines, "A credential reaches only its own site, so this is not a full account listing."].join("\n");
|
|
67
69
|
}
|
|
68
70
|
function detailText(detail) {
|
|
69
71
|
const site = detail.site;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// src/adapter/registry.ts
|
|
2
|
+
async function preview(name) {
|
|
3
|
+
const { previewCacheDir, resolveRenderer } = await import("./renderer-LKTT533L.js");
|
|
4
|
+
const report = (message) => {
|
|
5
|
+
process.stderr.write(message + "\n");
|
|
6
|
+
};
|
|
7
|
+
const provider = () => resolveRenderer({ reportLimitation: report, reportOffline: report, reportProgress: report });
|
|
8
|
+
const cache = previewCacheDir();
|
|
9
|
+
if (name === "check") return import("./check-YVUYIH3Y.js").then((m) => (program) => m.registerCheck(program, provider, cache));
|
|
10
|
+
if (name === "dev") return import("./dev-G24A7FEQ.js").then((m) => (program) => m.registerDev(program, provider, cache));
|
|
11
|
+
if (name === "build") return import("./build-SSRHSDDN.js").then((m) => (program) => m.registerBuild(program, provider, cache));
|
|
12
|
+
return import("./broken-links-E4GALBEW.js").then((m) => (program) => m.registerBrokenLinks(program, provider, cache));
|
|
13
|
+
}
|
|
14
|
+
var COMMAND_GROUPS = Object.freeze([
|
|
15
|
+
{ name: "manage", summary: "Call one management operation through the dashboard API", renderer: false, load: () => import("./manage-25YZ3NEO.js").then((m) => m.registerManage), metadata: () => import("./manage-25YZ3NEO.js").then((m) => m.MANAGE_METADATA) },
|
|
16
|
+
{ name: "requests", hidden: process.env.SATURNDOCS_BETA !== "1", summary: "Beta. Documentation requests and the conversations behind them", renderer: false, load: () => import("./requests-326KNATQ.js").then((m) => m.registerRequests), metadata: () => import("./requests-326KNATQ.js").then((m) => m.REQUESTS_METADATA) },
|
|
17
|
+
{ name: "suggestions", hidden: process.env.SATURNDOCS_BETA !== "1", summary: "Beta. Read a site's suggestions and diff the content they carry", renderer: false, load: () => import("./suggestions-4PE6SHVW.js").then((m) => m.registerSuggestions), metadata: () => import("./suggestions-4PE6SHVW.js").then((m) => m.SUGGESTIONS_METADATA) },
|
|
18
|
+
{ name: "schema", summary: "Print this CLI's own command metadata, locally", renderer: false, load: () => import("./schema-IGC5XO4E.js").then((m) => m.registerSchema), metadata: () => import("./schema-IGC5XO4E.js").then((m) => m.SCHEMA_METADATA) },
|
|
19
|
+
{ name: "login", summary: "Ask a person to approve this agent for one site, then save the login", renderer: false, load: () => import("./login-ZE257BGZ.js").then((m) => m.registerLogin), metadata: () => import("./login-ZE257BGZ.js").then((m) => m.LOGIN_METADATA) },
|
|
20
|
+
{ name: "logout", summary: "Revoke a saved login and delete it from this computer", renderer: false, load: () => import("./login-ZE257BGZ.js").then((m) => m.registerLogout), metadata: () => import("./login-ZE257BGZ.js").then((m) => m.LOGOUT_METADATA) },
|
|
21
|
+
{ name: "auth", summary: "Check the credential this CLI will use", renderer: false, load: () => import("./auth-76SYM7IA.js").then((m) => m.registerAuth), metadata: () => import("./auth-76SYM7IA.js").then((m) => m.AUTH_METADATA) },
|
|
22
|
+
{ name: "sites", summary: "Create a site, or discover and inspect the sites this credential reaches", renderer: false, load: () => import("./sites-ECFP6IMI.js").then((m) => m.registerSites), metadata: () => import("./sites-ECFP6IMI.js").then((m) => m.SITES_METADATA) },
|
|
23
|
+
{ name: "pages", summary: "Read the published pages of the release readers are seeing", renderer: false, load: () => import("./pages-ZUAODNC6.js").then((m) => m.registerPages), metadata: () => import("./pages-ZUAODNC6.js").then((m) => m.PAGES_METADATA) },
|
|
24
|
+
{ name: "releases", summary: "Read this site's release history, and make the pinned release live again", renderer: false, load: () => import("./read-KXU34B5I.js").then((m) => m.registerReleases), metadata: () => import("./read-KXU34B5I.js").then((m) => m.RELEASES_METADATA) },
|
|
25
|
+
{ name: "status", summary: "One bounded briefing on a site, section by section", renderer: false, load: () => import("./status-3UNBNX4X.js").then((m) => m.registerStatus), metadata: () => import("./status-3UNBNX4X.js").then((m) => m.STATUS_METADATA) },
|
|
26
|
+
{ name: "activity", summary: "Read what the platform did, and one job by id", renderer: false, load: () => import("./read-NA76WCIK.js").then((m) => m.registerActivity), metadata: () => import("./read-NA76WCIK.js").then((m) => m.ACTIVITY_METADATA) },
|
|
27
|
+
{ name: "check", summary: "Run every local check before a push: validate, lint, and rendered links; exits 2 when any finding is an error", renderer: true, load: () => preview("check"), metadata: () => import("./local-metadata-5KLCOASW.js").then((m) => m.CHECK_METADATA) },
|
|
28
|
+
{ name: "validate", summary: "Validate docs.json, page files, assets, links, and OpenAPI specs; exits 2 on any error", renderer: true, load: () => import("./validate-PMTH2ICX.js").then((m) => m.registerValidate), metadata: () => import("./local-metadata-5KLCOASW.js").then((m) => m.VALIDATE_METADATA) },
|
|
29
|
+
{ name: "lint", summary: "Content lint and the known-pitfalls catalog over every page; exits 2 when any finding is an error", renderer: false, load: () => import("./lint-XQQEHOHB.js").then((m) => m.registerLint), metadata: () => import("./lint-XQQEHOHB.js").then((m) => m.LINT_METADATA) },
|
|
30
|
+
{ name: "broken-links", summary: "Build the docs and report every link and fragment that does not resolve", renderer: true, load: () => preview("broken-links"), metadata: () => import("./local-metadata-5KLCOASW.js").then((m) => m.BROKEN_LINKS_METADATA) },
|
|
31
|
+
{ name: "build", summary: "Build the docs into a static site with the production renderer", renderer: true, load: () => preview("build"), metadata: () => import("./local-metadata-5KLCOASW.js").then((m) => m.BUILD_METADATA) },
|
|
32
|
+
{ name: "dev", summary: "Preview the docs on this computer with the production renderer, rebuilding on each change", renderer: true, load: () => preview("dev"), metadata: () => import("./local-metadata-5KLCOASW.js").then((m) => m.DEV_METADATA) },
|
|
33
|
+
{ name: "init", summary: "Scaffold a docs project", renderer: true, load: () => import("./init-O4R3LDNE.js").then((m) => m.registerInit), metadata: () => import("./local-metadata-5KLCOASW.js").then((m) => m.INIT_METADATA) },
|
|
34
|
+
{ name: "openapi-check", summary: "Parse OpenAPI specs and print an operation table", renderer: true, load: () => import("./openapiCheck-HLWOQZKQ.js").then((m) => m.registerOpenapiCheck), metadata: () => import("./local-metadata-5KLCOASW.js").then((m) => m.OPENAPI_CHECK_METADATA) },
|
|
35
|
+
{ name: "nav", summary: "Rewrite docs.json navigation from an approved outline", renderer: false, load: () => import("./nav-35UUYP45.js").then((m) => m.registerNav), metadata: () => import("./nav-35UUYP45.js").then((m) => m.NAV_METADATA) },
|
|
36
|
+
{ name: "coverage", summary: "Check local pages against an approved outline", renderer: false, load: () => import("./coverage-XQU3PEAH.js").then((m) => m.registerCoverage), metadata: () => import("./coverage-XQU3PEAH.js").then((m) => m.COVERAGE_METADATA) }
|
|
37
|
+
]);
|
|
38
|
+
var COMMAND_GROUP_NAMES = Object.freeze(COMMAND_GROUPS.map((group) => group.name));
|
|
39
|
+
var LISTED_COMMAND_GROUPS = Object.freeze(COMMAND_GROUPS.filter((group) => group.hidden !== true));
|
|
40
|
+
function findCommandGroup(name) {
|
|
41
|
+
return COMMAND_GROUPS.find((group) => group.name === name);
|
|
42
|
+
}
|
|
43
|
+
var VALUE_FLAGS = /* @__PURE__ */ new Set(["--site", "--api", "--timeout"]);
|
|
44
|
+
function commandWords(argv) {
|
|
45
|
+
const words = [];
|
|
46
|
+
for (let index = 2; index < argv.length; index += 1) {
|
|
47
|
+
const token = argv[index];
|
|
48
|
+
if (token === "--") break;
|
|
49
|
+
if (VALUE_FLAGS.has(token)) {
|
|
50
|
+
index += 1;
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
if (!token.startsWith("-")) words.push(token);
|
|
54
|
+
}
|
|
55
|
+
return words;
|
|
56
|
+
}
|
|
57
|
+
function selectCommandGroup(argv) {
|
|
58
|
+
for (const word of commandWords(argv)) {
|
|
59
|
+
const group = findCommandGroup(word);
|
|
60
|
+
if (group !== void 0) return group;
|
|
61
|
+
}
|
|
62
|
+
return void 0;
|
|
63
|
+
}
|
|
64
|
+
var RETIRED_COMMANDS = Object.freeze({
|
|
65
|
+
deploy: "saturndocs deploy is retired. A site publishes when you push to its connected GitHub repository. Nothing was uploaded."
|
|
66
|
+
});
|
|
67
|
+
function retiredCommand(argv) {
|
|
68
|
+
const [name] = commandWords(argv);
|
|
69
|
+
const message = name === void 0 || !Object.hasOwn(RETIRED_COMMANDS, name) ? void 0 : RETIRED_COMMANDS[name];
|
|
70
|
+
return name === void 0 || message === void 0 ? void 0 : { name, message };
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export {
|
|
74
|
+
COMMAND_GROUPS,
|
|
75
|
+
COMMAND_GROUP_NAMES,
|
|
76
|
+
findCommandGroup,
|
|
77
|
+
selectCommandGroup,
|
|
78
|
+
retiredCommand
|
|
79
|
+
};
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
collectOutsideRootFiles,
|
|
3
3
|
configLocator,
|
|
4
4
|
validateDocsDetailed
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-N5W667O7.js";
|
|
6
6
|
import {
|
|
7
7
|
SOURCE_ALLOWED_ROOTS,
|
|
8
8
|
SOURCE_LIMITS,
|
|
@@ -12,10 +12,13 @@ import {
|
|
|
12
12
|
frontmatterPolicy,
|
|
13
13
|
normalizeComponentMarkdown,
|
|
14
14
|
validateBundleStructure
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-HWAQ2YEK.js";
|
|
16
16
|
import {
|
|
17
17
|
parseDocsConfig
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-YXS34FS2.js";
|
|
19
|
+
import {
|
|
20
|
+
invalidInput
|
|
21
|
+
} from "./chunk-FNPG5423.js";
|
|
19
22
|
|
|
20
23
|
// src/lib/preview/components.ts
|
|
21
24
|
import { spawn } from "child_process";
|
|
@@ -1567,11 +1570,23 @@ async function previewFonts(config, cache, directory, signal) {
|
|
|
1567
1570
|
// src/lib/preview/generation.ts
|
|
1568
1571
|
var roots = new Map(SOURCE_ALLOWED_ROOTS.map((pattern) => [pattern.split("/")[0], pattern.includes("/")]));
|
|
1569
1572
|
var previewRoots = new Set(roots.keys());
|
|
1573
|
+
var NO_READER_PREVIEW = "Check this site with validate and lint. Local preview does not support reader sign-in.";
|
|
1574
|
+
function issueLine(issue) {
|
|
1575
|
+
const head = `${issue.path ?? "bundle"}:${issue.line ?? 1}:${issue.column ?? 1}: ${issue.message}`;
|
|
1576
|
+
return issue.fix === null || issue.message.includes(issue.fix) ? head : `${head}
|
|
1577
|
+
fix: ${issue.fix}`;
|
|
1578
|
+
}
|
|
1579
|
+
function sourceError(issues) {
|
|
1580
|
+
return invalidInput(issues.map(issueLine).join("\n"), { data: { errors: issues } });
|
|
1581
|
+
}
|
|
1582
|
+
function sourceIssue(path2, line, column, code, message, fix = null) {
|
|
1583
|
+
return { path: path2, line, column, code, message, fix };
|
|
1584
|
+
}
|
|
1570
1585
|
function checkConfig(text) {
|
|
1571
1586
|
const config = parseDocsConfig(JSON.parse(text));
|
|
1572
1587
|
if (config.type === "portal" || config.auth?.oidc) {
|
|
1573
1588
|
const loc = configLocator(text)(config.type === "portal" ? ["type"] : ["auth", "oidc"]);
|
|
1574
|
-
throw
|
|
1589
|
+
throw sourceError([sourceIssue("docs.json", loc?.line ?? 1, loc?.column ?? 1, "preview_unsupported", "Reader sign-in cannot be previewed on this computer.", NO_READER_PREVIEW)]);
|
|
1575
1590
|
}
|
|
1576
1591
|
return config;
|
|
1577
1592
|
}
|
|
@@ -1579,10 +1594,13 @@ function checkPage(file, bytes) {
|
|
|
1579
1594
|
try {
|
|
1580
1595
|
if (!frontmatterPolicy(bytes).grouped) return;
|
|
1581
1596
|
} catch (error) {
|
|
1582
|
-
throw
|
|
1597
|
+
throw sourceError([sourceIssue(file, 1, 1, "invalid_frontmatter", `Cannot read reader policy. Correct the page frontmatter. ${error}`)]);
|
|
1583
1598
|
}
|
|
1584
1599
|
const line = new TextDecoder().decode(bytes).split("\n").findIndex((l) => /^groups\s*:/.test(l));
|
|
1585
|
-
throw
|
|
1600
|
+
throw sourceError([sourceIssue(file, Math.max(1, line + 1), 1, "preview_unsupported", "Reader groups cannot be previewed on this computer.", NO_READER_PREVIEW)]);
|
|
1601
|
+
}
|
|
1602
|
+
function isSourceError(error) {
|
|
1603
|
+
return error instanceof Error && error.name === "CliError" && error.code === "invalid_input";
|
|
1586
1604
|
}
|
|
1587
1605
|
async function buildGeneration(docs, dir, cache, renderer, siteUrl, policyChecked, signal, linkCheck = "source") {
|
|
1588
1606
|
const started = performance.now();
|
|
@@ -1593,7 +1611,8 @@ async function buildGeneration(docs, dir, cache, renderer, siteUrl, policyChecke
|
|
|
1593
1611
|
try {
|
|
1594
1612
|
config = checkConfig(readFileSync2(join4(source, "docs.json"), "utf8"));
|
|
1595
1613
|
} catch (error) {
|
|
1596
|
-
|
|
1614
|
+
if (isSourceError(error)) throw error;
|
|
1615
|
+
throw sourceError([sourceIssue("docs.json", 1, 1, "invalid_docs_json", `Cannot admit docs.json. Check the site configuration. ${error}`)]);
|
|
1597
1616
|
}
|
|
1598
1617
|
for (const file of paths.filter((file2) => file2.startsWith("pages/"))) checkPage(file, readFileSync2(join4(source, file)));
|
|
1599
1618
|
policyChecked?.(true);
|
|
@@ -1605,14 +1624,18 @@ async function buildGeneration(docs, dir, cache, renderer, siteUrl, policyChecke
|
|
|
1605
1624
|
hash.update(JSON.stringify([path2, bytes.length])).update(bytes);
|
|
1606
1625
|
}
|
|
1607
1626
|
const invalid = validateBundleStructure(inventory).filter((v) => v.severity === "error");
|
|
1608
|
-
if (invalid.length)
|
|
1627
|
+
if (invalid.length) {
|
|
1628
|
+
throw sourceError(invalid.map((v) => ({ path: v.path ?? null, line: v.line ?? null, column: v.column ?? null, code: v.code, message: v.message, fix: v.fix ?? null })));
|
|
1629
|
+
}
|
|
1609
1630
|
const validation = await validateDocsDetailed(source, new Set(paths));
|
|
1610
|
-
const
|
|
1611
|
-
|
|
1631
|
+
const deadLinks = validation.errors.filter((e) => e.code === "unresolved_link");
|
|
1632
|
+
const errors = validation.errors.filter((e) => e.code !== "unresolved_link");
|
|
1633
|
+
if (errors.length) throw sourceError(errors);
|
|
1612
1634
|
const site = new URL(siteUrl ?? config.siteUrl ?? "http://localhost/");
|
|
1613
|
-
if (!["https:", "http:"].includes(site.protocol) || site.username || site.password) throw
|
|
1635
|
+
if (!["https:", "http:"].includes(site.protocol) || site.username || site.password) throw invalidInput("Expected an HTTP(S) site URL");
|
|
1614
1636
|
const { fonts, warnings } = await previewFonts(config, cache, join4(dir, "fonts"), signal);
|
|
1615
1637
|
warnings.push(...validation.warnings.map((issue) => `${issue.path ?? "bundle"}: ${issue.message}`));
|
|
1638
|
+
if (linkCheck === "source") warnings.push(...deadLinks.map((issue) => `${issue.path}:${issue.line ?? 1}:${issue.column ?? 1}: ${issue.message}`));
|
|
1616
1639
|
signal?.throwIfAborted();
|
|
1617
1640
|
const components = await previewComponents(source, paths, dir, renderer.root, signal);
|
|
1618
1641
|
const out = join4(dir, "site");
|
|
@@ -1624,11 +1647,11 @@ async function buildGeneration(docs, dir, cache, renderer, siteUrl, policyChecke
|
|
|
1624
1647
|
policy = JSON.parse(readFileSync2(join4(worker, "auth-manifest.json"), "utf8"));
|
|
1625
1648
|
} catch {
|
|
1626
1649
|
policyChecked?.(false);
|
|
1627
|
-
throw new Error("worker/auth-manifest.json:1:1: Cannot read reader policy.
|
|
1650
|
+
throw new Error("worker/auth-manifest.json:1:1: Cannot read reader policy.");
|
|
1628
1651
|
}
|
|
1629
1652
|
if (!isAuthzManifest(policy) || policy.requireAuth || policy.routes.length || policy.oidc) {
|
|
1630
1653
|
policyChecked?.(false);
|
|
1631
|
-
throw
|
|
1654
|
+
throw sourceError([sourceIssue("docs.json", 1, 1, "preview_unsupported", "The rendered site restricts reader access, which cannot be previewed on this computer.", NO_READER_PREVIEW)]);
|
|
1632
1655
|
}
|
|
1633
1656
|
return { out, worker, policy, report: {
|
|
1634
1657
|
author_preview: true,
|
|
@@ -396,6 +396,7 @@ async function resolve(options) {
|
|
|
396
396
|
const archive = path2.join(stage, "archive");
|
|
397
397
|
const hash = createHash2("sha256");
|
|
398
398
|
let size = 0;
|
|
399
|
+
options.reportProgress?.("Downloading the SaturnDocs renderer (" + Math.ceil(target.bytes / 1e6) + " MB). This happens once for each renderer release.");
|
|
399
400
|
const download = await get(target.path, 3e5);
|
|
400
401
|
await pipeline2(async function* () {
|
|
401
402
|
for await (const chunk of chunks(download, target.bytes)) {
|
|
@@ -434,8 +435,8 @@ async function resolveRenderer(options = {}) {
|
|
|
434
435
|
throw new RendererError("RENDERER_INVALID", error instanceof Error ? error.message : String(error));
|
|
435
436
|
}
|
|
436
437
|
}
|
|
438
|
+
|
|
437
439
|
export {
|
|
438
|
-
RendererError,
|
|
439
440
|
previewCacheDir,
|
|
440
441
|
resolveRenderer
|
|
441
442
|
};
|