sourcey 3.6.0 → 3.6.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/README.md +5 -2
- package/dist/adapters/index.d.ts +3 -2
- package/dist/adapters/index.d.ts.map +1 -1
- package/dist/adapters/index.js +35 -3
- package/dist/adapters/types.d.ts +8 -2
- package/dist/adapters/types.d.ts.map +1 -1
- package/dist/cli.js +28 -34
- package/dist/client/search.js +181 -119
- package/dist/client/tabs.js +23 -0
- package/dist/components/layout/Head.js +2 -2
- package/dist/components/openapi/Introduction.d.ts.map +1 -1
- package/dist/components/openapi/Introduction.js +16 -1
- package/dist/components/openapi/Security.d.ts.map +1 -1
- package/dist/components/openapi/Security.js +18 -2
- package/dist/config.d.ts +63 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +21 -7
- package/dist/core/api-rendering.d.ts +47 -0
- package/dist/core/api-rendering.d.ts.map +1 -0
- package/dist/core/api-rendering.js +76 -0
- package/dist/core/doxygen-loader.d.ts.map +1 -1
- package/dist/core/doxygen-loader.js +35 -18
- package/dist/core/godoc-loader.d.ts.map +1 -1
- package/dist/core/godoc-loader.js +17 -6
- package/dist/core/markdown-loader.d.ts.map +1 -1
- package/dist/core/markdown-loader.js +8 -5
- package/dist/core/mcp-normalizer.d.ts.map +1 -1
- package/dist/core/mcp-normalizer.js +48 -34
- package/dist/core/parser.d.ts.map +1 -1
- package/dist/core/parser.js +75 -4
- package/dist/core/rustdoc-introspector.d.ts +29 -0
- package/dist/core/rustdoc-introspector.d.ts.map +1 -0
- package/dist/core/rustdoc-introspector.js +236 -0
- package/dist/core/rustdoc-loader.d.ts +25 -0
- package/dist/core/rustdoc-loader.d.ts.map +1 -0
- package/dist/core/rustdoc-loader.js +469 -0
- package/dist/core/rustdoc-render.d.ts +76 -0
- package/dist/core/rustdoc-render.d.ts.map +1 -0
- package/dist/core/rustdoc-render.js +785 -0
- package/dist/core/rustdoc-types.d.ts +314 -0
- package/dist/core/rustdoc-types.d.ts.map +1 -0
- package/dist/core/rustdoc-types.js +18 -0
- package/dist/core/search-indexer.js +1 -1
- package/dist/core/sourcey-rustdoc/Cargo.lock +705 -0
- package/dist/core/sourcey-rustdoc/Cargo.toml +38 -0
- package/dist/core/sourcey-rustdoc/README.md +59 -0
- package/dist/core/sourcey-rustdoc/src/diagnostics.rs +42 -0
- package/dist/core/sourcey-rustdoc/src/doctest.rs +268 -0
- package/dist/core/sourcey-rustdoc/src/extract.rs +492 -0
- package/dist/core/sourcey-rustdoc/src/lib.rs +58 -0
- package/dist/core/sourcey-rustdoc/src/links.rs +126 -0
- package/dist/core/sourcey-rustdoc/src/main.rs +256 -0
- package/dist/core/sourcey-rustdoc/src/signature.rs +415 -0
- package/dist/core/sourcey-rustdoc/src/spec.rs +390 -0
- package/dist/core/sourcey-rustdoc/tests/format_version.rs +45 -0
- package/dist/dev-server.d.ts.map +1 -1
- package/dist/dev-server.js +49 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -13
- package/dist/init.js +2 -2
- package/dist/renderer/changelog-feed.d.ts.map +1 -1
- package/dist/renderer/changelog-feed.js +27 -19
- package/dist/renderer/html-builder.d.ts.map +1 -1
- package/dist/renderer/html-builder.js +4 -3
- package/dist/renderer/llms.js +57 -2
- package/dist/site-assembly.d.ts +5 -0
- package/dist/site-assembly.d.ts.map +1 -1
- package/dist/site-assembly.js +55 -1
- package/dist/themes/default/sourcey.css +300 -0
- package/dist/utils/code-samples.d.ts +1 -0
- package/dist/utils/code-samples.d.ts.map +1 -1
- package/dist/utils/code-samples.js +30 -22
- package/dist/utils/html.d.ts +10 -0
- package/dist/utils/html.d.ts.map +1 -0
- package/dist/utils/html.js +152 -0
- package/dist/utils/http.d.ts +0 -2
- package/dist/utils/http.d.ts.map +1 -1
- package/dist/utils/http.js +19 -34
- package/dist/utils/markdown.d.ts.map +1 -1
- package/dist/utils/markdown.js +102 -37
- package/package.json +9 -4
package/README.md
CHANGED
|
@@ -12,6 +12,8 @@ No dashboard. No runtime. No API calls to render your own documentation.
|
|
|
12
12
|
[](LICENSE)
|
|
13
13
|
[](https://pkg.go.dev/github.com/sourcey/sourcey/go/sourcey-godoc)
|
|
14
14
|
[](https://goreportcard.com/report/github.com/sourcey/sourcey/go/sourcey-godoc)
|
|
15
|
+
[](https://crates.io/crates/sourcey)
|
|
16
|
+
[](https://docs.rs/sourcey)
|
|
15
17
|
|
|
16
18
|
```bash
|
|
17
19
|
npx sourcey init
|
|
@@ -31,6 +33,7 @@ npx sourcey init
|
|
|
31
33
|
- **Product story pages**: changelog, roadmap pages, examples, reference material, search, and portable context exports in one source-owned site
|
|
32
34
|
- **C++ and Doxygen**: feed Doxygen XML output, get modern searchable API docs with exact member search, source links, templates, qualifiers, examples, inherited members, and relationship sections. No new parser, no four-tool Breathe/Exhale/Sphinx pipeline
|
|
33
35
|
- **Go and godoc**: native package documentation extracted from Go source via the toolchain. Render Go modules as Sourcey tabs, generate standalone static Go docs sites, or commit `godoc.json` snapshots for JS-only docs hosts. No Doxygen detour
|
|
36
|
+
- **Rust and rustdoc**: native API documentation from nightly rustdoc JSON, with doctests as a first-class extracted view. URL-encoded parametric impl anchors for deep-link parity with doc.rust-lang.org. Snapshot mode lets CI build on stable Rust toolchains. Aggregated doctests index across the workspace
|
|
34
37
|
- **Context exports**: auto-generate llms.txt and llms-full.txt alongside your HTML as alternate views of the same documentation graph
|
|
35
38
|
- **TypeScript config**: `sourcey.config.ts` with `defineConfig()` autocomplete; theme, navbar, CTA buttons, footer
|
|
36
39
|
- **Theme presets**: default (sidebar + TOC), minimal (single column), api-first (Stripe-style three column); colors, fonts, layout dimensions, and custom CSS on top
|
|
@@ -44,7 +47,7 @@ npx sourcey init
|
|
|
44
47
|
|
|
45
48
|
### Sourcey CLI
|
|
46
49
|
|
|
47
|
-
The full Sourcey binary handles OpenAPI, Doxygen, godoc,
|
|
50
|
+
The full Sourcey binary handles OpenAPI, MCP, Doxygen, godoc, rustdoc, MkDocs, and Markdown sources.
|
|
48
51
|
|
|
49
52
|
| Path | Command | Requires |
|
|
50
53
|
| -------- | ---------------------------------------------- | ----------------- |
|
|
@@ -93,7 +96,7 @@ export default defineConfig({
|
|
|
93
96
|
});
|
|
94
97
|
```
|
|
95
98
|
|
|
96
|
-
Each tab has one `source`, usually created with `markdown()`, `mkdocs()`, `openapi()`, `mcp()`, `doxygen()`, or `
|
|
99
|
+
Each tab has one `source`, usually created with `markdown()`, `mkdocs()`, `openapi()`, `mcp()`, `doxygen()`, `godoc()`, or `rustdoc()`. Pages are referenced by slug (e.g. `"quickstart"` resolves to `quickstart.md`). See [docs/configuration.md](docs/configuration.md) for theme, navbar, footer, logo, and full tab options.
|
|
97
100
|
|
|
98
101
|
### Go documentation (godoc)
|
|
99
102
|
|
package/dist/adapters/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DoxygenSourceOptions, GodocSourceOptions, MarkdownSourceOptions, McpSourceOptions, MkDocsSourceOptions, OpenApiSourceOptions, SourceAdapter } from "./types.js";
|
|
1
|
+
import type { DoxygenSourceOptions, GodocSourceOptions, MarkdownSourceOptions, McpSourceOptions, MkDocsSourceOptions, OpenApiSourceOptions, RustdocSourceOptions, SourceAdapter } from "./types.js";
|
|
2
2
|
import { assertLocalPath } from "./shared.js";
|
|
3
3
|
export declare function openapi(specOrOptions: string | OpenApiSourceOptions): SourceAdapter;
|
|
4
4
|
export declare function mcp(specOrOptions: string | McpSourceOptions): SourceAdapter;
|
|
@@ -6,6 +6,7 @@ export declare function markdown(options: MarkdownSourceOptions): SourceAdapter;
|
|
|
6
6
|
export declare function mkdocs(configOrOptions: string | MkDocsSourceOptions): SourceAdapter;
|
|
7
7
|
export declare function doxygen(options: DoxygenSourceOptions): SourceAdapter;
|
|
8
8
|
export declare function godoc(configOrPath: GodocSourceOptions): SourceAdapter;
|
|
9
|
+
export declare function rustdoc(configOrPath: RustdocSourceOptions): SourceAdapter;
|
|
9
10
|
export { assertLocalPath };
|
|
10
|
-
export type { DoxygenSourceOptions, GodocSourceOptions, MarkdownSourceOptions, McpSourceOptions, MkDocsSourceOptions, OpenApiSourceOptions, PageMarkdownOptions, ResolvedTabSource, SourceAdapter, SourceAdapterContext, } from "./types.js";
|
|
11
|
+
export type { DoxygenSourceOptions, GodocSourceOptions, MarkdownSourceOptions, McpSourceOptions, MkDocsSourceOptions, OpenApiSourceOptions, PageMarkdownOptions, ResolvedTabSource, RustdocSourceOptions, SourceAdapter, SourceAdapterContext, } from "./types.js";
|
|
11
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,aAAa,EACd,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,eAAe,EAAuC,MAAM,aAAa,CAAC;AAGnF,wBAAgB,OAAO,CAAC,aAAa,EAAE,MAAM,GAAG,oBAAoB,GAAG,aAAa,CAanF;AAED,wBAAgB,GAAG,CAAC,aAAa,EAAE,MAAM,GAAG,gBAAgB,GAAG,aAAa,CAa3E;AAED,wBAAgB,QAAQ,CAAC,OAAO,EAAE,qBAAqB,GAAG,aAAa,CAWtE;AAED,wBAAgB,MAAM,CAAC,eAAe,EAAE,MAAM,GAAG,mBAAmB,GAAG,aAAa,CAInF;AAED,wBAAgB,OAAO,CAAC,OAAO,EAAE,oBAAoB,GAAG,aAAa,CAsBpE;AAED,wBAAgB,KAAK,CAAC,YAAY,EAAE,kBAAkB,GAAG,aAAa,CA6BrE;AAED,wBAAgB,OAAO,CAAC,YAAY,EAAE,oBAAoB,GAAG,aAAa,CAmCzE;AAMD,OAAO,EAAE,eAAe,EAAE,CAAC;AAC3B,YAAY,EACV,oBAAoB,EACpB,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,aAAa,EACb,oBAAoB,GACrB,MAAM,YAAY,CAAC"}
|
package/dist/adapters/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { resolve } from "node:path";
|
|
2
1
|
import { assertLocalPath, resolveMarkdownGroups, toWatchPaths } from "./shared.js";
|
|
3
2
|
import { mkdocs as mkdocsAdapter } from "./mkdocs.js";
|
|
4
3
|
export function openapi(specOrOptions) {
|
|
@@ -49,7 +48,7 @@ export function doxygen(options) {
|
|
|
49
48
|
return {
|
|
50
49
|
name: "doxygen",
|
|
51
50
|
async resolve(ctx) {
|
|
52
|
-
const absXml = ctx
|
|
51
|
+
const absXml = assertLocalPath(ctx, options.xml, "Doxygen XML directory");
|
|
53
52
|
await ctx.assertExists(absXml, `Doxygen XML directory "${options.xml}" in tab "${ctx.tabName}"`);
|
|
54
53
|
return {
|
|
55
54
|
kind: "doxygen",
|
|
@@ -70,7 +69,7 @@ export function godoc(configOrPath) {
|
|
|
70
69
|
name: "godoc",
|
|
71
70
|
async resolve(ctx) {
|
|
72
71
|
const cfg = typeof configOrPath === "string" ? { module: configOrPath } : configOrPath;
|
|
73
|
-
const moduleAbs =
|
|
72
|
+
const moduleAbs = assertLocalPath(ctx, cfg.module ?? ".", "Go module directory");
|
|
74
73
|
await ctx.assertExists(moduleAbs, `Go module directory "${cfg.module ?? "."}" in tab "${ctx.tabName}"`);
|
|
75
74
|
const snapshotAbs = cfg.snapshot ? ctx.resolvePath(cfg.snapshot) : undefined;
|
|
76
75
|
return {
|
|
@@ -92,6 +91,39 @@ export function godoc(configOrPath) {
|
|
|
92
91
|
},
|
|
93
92
|
};
|
|
94
93
|
}
|
|
94
|
+
export function rustdoc(configOrPath) {
|
|
95
|
+
return {
|
|
96
|
+
name: "rustdoc",
|
|
97
|
+
async resolve(ctx) {
|
|
98
|
+
const cfg = typeof configOrPath === "string" ? { manifest: configOrPath } : configOrPath;
|
|
99
|
+
const manifestAbs = assertLocalPath(ctx, cfg.manifest ?? ".", "Cargo manifest");
|
|
100
|
+
await ctx.assertExists(manifestAbs, `Cargo manifest "${cfg.manifest ?? "."}" in tab "${ctx.tabName}"`);
|
|
101
|
+
const snapshotAbs = cfg.snapshot ? ctx.resolvePath(cfg.snapshot) : undefined;
|
|
102
|
+
const features = {
|
|
103
|
+
default: cfg.features?.default ?? true,
|
|
104
|
+
list: cfg.features?.list ?? [],
|
|
105
|
+
all: cfg.features?.all ?? false,
|
|
106
|
+
};
|
|
107
|
+
return {
|
|
108
|
+
kind: "rustdoc",
|
|
109
|
+
config: {
|
|
110
|
+
manifest: manifestAbs,
|
|
111
|
+
crates: cfg.crates?.length ? cfg.crates : [],
|
|
112
|
+
snapshot: snapshotAbs,
|
|
113
|
+
mode: cfg.mode ?? "auto",
|
|
114
|
+
features,
|
|
115
|
+
includePrivate: cfg.includePrivate ?? false,
|
|
116
|
+
includeHidden: cfg.includeHidden ?? false,
|
|
117
|
+
target: cfg.target,
|
|
118
|
+
toolchain: cfg.toolchain ?? "nightly",
|
|
119
|
+
sourceBasePath: trimSlashes(cfg.sourceBasePath ?? ""),
|
|
120
|
+
doctestsIndex: cfg.doctestsIndex ?? true,
|
|
121
|
+
},
|
|
122
|
+
watchPaths: toWatchPaths([snapshotAbs]),
|
|
123
|
+
};
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
}
|
|
95
127
|
function trimSlashes(value) {
|
|
96
128
|
return value.replace(/^\/+|\/+$/g, "");
|
|
97
129
|
}
|
package/dist/adapters/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { MarkdownPreprocessor } from "../core/markdown-loader.js";
|
|
2
|
-
import type { DoxygenConfig, GodocConfig, GroupConfig, ResolvedDoxygenConfig, ResolvedGodocConfig, ResolvedGroup } from "../config.js";
|
|
2
|
+
import type { DoxygenConfig, GodocConfig, GroupConfig, ResolvedDoxygenConfig, ResolvedGodocConfig, ResolvedGroup, ResolvedRustdocConfig, RustdocConfig } from "../config.js";
|
|
3
3
|
export interface SourceAdapterContext {
|
|
4
4
|
configDir: string;
|
|
5
5
|
tabName: string;
|
|
@@ -46,7 +46,12 @@ export interface ResolvedGodocSource {
|
|
|
46
46
|
config: ResolvedGodocConfig;
|
|
47
47
|
watchPaths?: string[];
|
|
48
48
|
}
|
|
49
|
-
export
|
|
49
|
+
export interface ResolvedRustdocSource {
|
|
50
|
+
kind: "rustdoc";
|
|
51
|
+
config: ResolvedRustdocConfig;
|
|
52
|
+
watchPaths?: string[];
|
|
53
|
+
}
|
|
54
|
+
export type ResolvedTabSource = ResolvedOpenApiSource | ResolvedMcpSource | ResolvedMarkdownSource | ResolvedDoxygenSource | ResolvedGodocSource | ResolvedRustdocSource;
|
|
50
55
|
export interface MarkdownSourceOptions {
|
|
51
56
|
groups: GroupConfig[];
|
|
52
57
|
}
|
|
@@ -61,6 +66,7 @@ export interface MkDocsSourceOptions {
|
|
|
61
66
|
}
|
|
62
67
|
export type DoxygenSourceOptions = DoxygenConfig;
|
|
63
68
|
export type GodocSourceOptions = GodocConfig | string;
|
|
69
|
+
export type RustdocSourceOptions = RustdocConfig | string;
|
|
64
70
|
export interface PageMarkdownOptions {
|
|
65
71
|
sourceRoot?: string;
|
|
66
72
|
preprocess?: MarkdownPreprocessor[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/adapters/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,KAAK,EACV,aAAa,EACb,WAAW,EACX,WAAW,EACX,qBAAqB,EACrB,mBAAmB,EACnB,aAAa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AW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,oBAAoB,GAAG,aAAa,CAAC;AACjD,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG,MAAM,CAAC;AACtD,MAAM,MAAM,oBAAoB,GAAG,aAAa,GAAG,MAAM,CAAC;AAE1D,MAAM,WAAW,mBAAmB;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,oBAAoB,EAAE,CAAC;CACrC"}
|
package/dist/cli.js
CHANGED
|
@@ -7,7 +7,7 @@ import { loadConfig } from "./config.js";
|
|
|
7
7
|
import { runIntrospector, GodocIntrospectorError } from "./core/godoc-introspector.js";
|
|
8
8
|
import { GODOC_SCHEMA_VERSION } from "./core/godoc-types.js";
|
|
9
9
|
import { init } from "./init.js";
|
|
10
|
-
import { formatChangelogDiagnostic, formatGodocDiagnostic } from "./site-assembly.js";
|
|
10
|
+
import { formatChangelogDiagnostic, formatGodocDiagnostic, formatRustdocDiagnostic, } from "./site-assembly.js";
|
|
11
11
|
import pkg from "../package.json" with { type: "json" };
|
|
12
12
|
const build = defineCommand({
|
|
13
13
|
meta: {
|
|
@@ -84,6 +84,7 @@ const build = defineCommand({
|
|
|
84
84
|
if (!args.quiet) {
|
|
85
85
|
logChangelogDiagnostics(result.changelogDiagnostics);
|
|
86
86
|
logGodocDiagnostics(result.godocDiagnostics);
|
|
87
|
+
logRustdocDiagnostics(result.rustdocDiagnostics);
|
|
87
88
|
const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
|
|
88
89
|
console.log(` Pages: ${result.pageCount}`);
|
|
89
90
|
console.log(` Output: ${result.outputDir}`);
|
|
@@ -129,8 +130,9 @@ const dev = defineCommand({
|
|
|
129
130
|
},
|
|
130
131
|
async run({ args }) {
|
|
131
132
|
const { startDevServer } = await import("./dev-server.js");
|
|
133
|
+
const port = parsePort(args.port);
|
|
132
134
|
await startDevServer({
|
|
133
|
-
port
|
|
135
|
+
port,
|
|
134
136
|
host: args.host ?? process.env.HOST,
|
|
135
137
|
config: args.config,
|
|
136
138
|
strictChangelog: args.strictChangelog,
|
|
@@ -214,9 +216,15 @@ const godoc = defineCommand({
|
|
|
214
216
|
},
|
|
215
217
|
async run({ args }) {
|
|
216
218
|
const moduleDir = resolve(process.cwd(), args.module);
|
|
217
|
-
const patterns = args.packages
|
|
219
|
+
const patterns = args.packages
|
|
220
|
+
.split(",")
|
|
221
|
+
.map((p) => p.trim())
|
|
222
|
+
.filter(Boolean);
|
|
218
223
|
const exclude = args.exclude
|
|
219
|
-
? args.exclude
|
|
224
|
+
? args.exclude
|
|
225
|
+
.split(",")
|
|
226
|
+
.map((p) => p.trim())
|
|
227
|
+
.filter(Boolean)
|
|
220
228
|
: [];
|
|
221
229
|
const outputPath = resolve(process.cwd(), args.out);
|
|
222
230
|
try {
|
|
@@ -282,36 +290,6 @@ const main = defineCommand({
|
|
|
282
290
|
validate,
|
|
283
291
|
godoc,
|
|
284
292
|
},
|
|
285
|
-
args: {
|
|
286
|
-
spec: {
|
|
287
|
-
type: "positional",
|
|
288
|
-
description: "Path to an OpenAPI spec (shorthand for 'sourcey build <spec>')",
|
|
289
|
-
required: false,
|
|
290
|
-
},
|
|
291
|
-
},
|
|
292
|
-
async run({ args, rawArgs }) {
|
|
293
|
-
if (rawArgs.includes("init") ||
|
|
294
|
-
rawArgs.includes("build") ||
|
|
295
|
-
rawArgs.includes("dev") ||
|
|
296
|
-
rawArgs.includes("validate") ||
|
|
297
|
-
rawArgs.includes("godoc"))
|
|
298
|
-
return;
|
|
299
|
-
if (args.spec) {
|
|
300
|
-
await build.run({
|
|
301
|
-
args: {
|
|
302
|
-
_: [],
|
|
303
|
-
spec: args.spec,
|
|
304
|
-
output: "dist",
|
|
305
|
-
embed: false,
|
|
306
|
-
config: undefined,
|
|
307
|
-
quiet: false,
|
|
308
|
-
strictChangelog: false,
|
|
309
|
-
},
|
|
310
|
-
rawArgs: [],
|
|
311
|
-
cmd: build,
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
|
-
},
|
|
315
293
|
});
|
|
316
294
|
function logChangelogDiagnostics(diagnostics) {
|
|
317
295
|
for (const diagnostic of diagnostics) {
|
|
@@ -324,4 +302,20 @@ function logGodocDiagnostics(diagnostics) {
|
|
|
324
302
|
writer(` ${formatGodocDiagnostic(diagnostic)}`);
|
|
325
303
|
}
|
|
326
304
|
}
|
|
305
|
+
function logRustdocDiagnostics(diagnostics) {
|
|
306
|
+
for (const diagnostic of diagnostics) {
|
|
307
|
+
const writer = diagnostic.severity === "error" ? console.error : console.log;
|
|
308
|
+
writer(` ${formatRustdocDiagnostic(diagnostic)}`);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
function parsePort(value) {
|
|
312
|
+
if (!/^\d+$/.test(value)) {
|
|
313
|
+
throw new Error(`Invalid port "${value}". Expected an integer from 1 to 65535.`);
|
|
314
|
+
}
|
|
315
|
+
const port = Number(value);
|
|
316
|
+
if (!Number.isInteger(port) || port < 1 || port > 65535) {
|
|
317
|
+
throw new Error(`Invalid port "${value}". Expected an integer from 1 to 65535.`);
|
|
318
|
+
}
|
|
319
|
+
return port;
|
|
320
|
+
}
|
|
327
321
|
runMain(main);
|