sourcey 3.5.10 → 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.
Files changed (100) hide show
  1. package/README.md +24 -97
  2. package/dist/adapters/index.d.ts +12 -0
  3. package/dist/adapters/index.d.ts.map +1 -0
  4. package/dist/adapters/index.js +130 -0
  5. package/dist/adapters/mkdocs.d.ts +5 -0
  6. package/dist/adapters/mkdocs.d.ts.map +1 -0
  7. package/dist/adapters/mkdocs.js +367 -0
  8. package/dist/adapters/shared.d.ts +12 -0
  9. package/dist/adapters/shared.d.ts.map +1 -0
  10. package/dist/adapters/shared.js +134 -0
  11. package/dist/adapters/types.d.ts +74 -0
  12. package/dist/adapters/types.d.ts.map +1 -0
  13. package/dist/adapters/types.js +1 -0
  14. package/dist/cli.js +28 -34
  15. package/dist/client/search.js +213 -82
  16. package/dist/client/tabs.js +23 -0
  17. package/dist/components/layout/Head.js +17 -4
  18. package/dist/components/layout/TableOfContents.d.ts.map +1 -1
  19. package/dist/components/layout/TableOfContents.js +4 -2
  20. package/dist/components/openapi/Introduction.d.ts.map +1 -1
  21. package/dist/components/openapi/Introduction.js +16 -1
  22. package/dist/components/openapi/Security.d.ts.map +1 -1
  23. package/dist/components/openapi/Security.js +18 -2
  24. package/dist/config.d.ts +101 -0
  25. package/dist/config.d.ts.map +1 -1
  26. package/dist/config.js +95 -143
  27. package/dist/core/api-rendering.d.ts +47 -0
  28. package/dist/core/api-rendering.d.ts.map +1 -0
  29. package/dist/core/api-rendering.js +76 -0
  30. package/dist/core/doxygen-loader.d.ts.map +1 -1
  31. package/dist/core/doxygen-loader.js +36 -17
  32. package/dist/core/godoc-loader.d.ts.map +1 -1
  33. package/dist/core/godoc-loader.js +17 -6
  34. package/dist/core/markdown-loader.d.ts +14 -0
  35. package/dist/core/markdown-loader.d.ts.map +1 -1
  36. package/dist/core/markdown-loader.js +70 -26
  37. package/dist/core/mcp-normalizer.d.ts.map +1 -1
  38. package/dist/core/mcp-normalizer.js +48 -34
  39. package/dist/core/navigation.d.ts.map +1 -1
  40. package/dist/core/navigation.js +8 -7
  41. package/dist/core/parser.d.ts.map +1 -1
  42. package/dist/core/parser.js +75 -4
  43. package/dist/core/rustdoc-introspector.d.ts +29 -0
  44. package/dist/core/rustdoc-introspector.d.ts.map +1 -0
  45. package/dist/core/rustdoc-introspector.js +236 -0
  46. package/dist/core/rustdoc-loader.d.ts +25 -0
  47. package/dist/core/rustdoc-loader.d.ts.map +1 -0
  48. package/dist/core/rustdoc-loader.js +469 -0
  49. package/dist/core/rustdoc-render.d.ts +76 -0
  50. package/dist/core/rustdoc-render.d.ts.map +1 -0
  51. package/dist/core/rustdoc-render.js +785 -0
  52. package/dist/core/rustdoc-types.d.ts +314 -0
  53. package/dist/core/rustdoc-types.d.ts.map +1 -0
  54. package/dist/core/rustdoc-types.js +18 -0
  55. package/dist/core/search-indexer.d.ts +10 -0
  56. package/dist/core/search-indexer.d.ts.map +1 -1
  57. package/dist/core/search-indexer.js +6 -1
  58. package/dist/core/sourcey-rustdoc/Cargo.lock +705 -0
  59. package/dist/core/sourcey-rustdoc/Cargo.toml +38 -0
  60. package/dist/core/sourcey-rustdoc/README.md +59 -0
  61. package/dist/core/sourcey-rustdoc/src/diagnostics.rs +42 -0
  62. package/dist/core/sourcey-rustdoc/src/doctest.rs +268 -0
  63. package/dist/core/sourcey-rustdoc/src/extract.rs +492 -0
  64. package/dist/core/sourcey-rustdoc/src/lib.rs +58 -0
  65. package/dist/core/sourcey-rustdoc/src/links.rs +126 -0
  66. package/dist/core/sourcey-rustdoc/src/main.rs +256 -0
  67. package/dist/core/sourcey-rustdoc/src/signature.rs +415 -0
  68. package/dist/core/sourcey-rustdoc/src/spec.rs +390 -0
  69. package/dist/core/sourcey-rustdoc/tests/format_version.rs +45 -0
  70. package/dist/dev-server.d.ts.map +1 -1
  71. package/dist/dev-server.js +109 -33
  72. package/dist/index.d.ts +4 -0
  73. package/dist/index.d.ts.map +1 -1
  74. package/dist/index.js +26 -14
  75. package/dist/init.d.ts.map +1 -1
  76. package/dist/init.js +21 -16
  77. package/dist/renderer/changelog-feed.d.ts.map +1 -1
  78. package/dist/renderer/changelog-feed.js +27 -19
  79. package/dist/renderer/html-builder.d.ts.map +1 -1
  80. package/dist/renderer/html-builder.js +4 -3
  81. package/dist/renderer/llms.js +57 -2
  82. package/dist/site-assembly.d.ts +5 -0
  83. package/dist/site-assembly.d.ts.map +1 -1
  84. package/dist/site-assembly.js +161 -25
  85. package/dist/themes/default/sourcey.css +300 -0
  86. package/dist/utils/code-samples.d.ts +1 -0
  87. package/dist/utils/code-samples.d.ts.map +1 -1
  88. package/dist/utils/code-samples.js +30 -22
  89. package/dist/utils/html.d.ts +10 -0
  90. package/dist/utils/html.d.ts.map +1 -0
  91. package/dist/utils/html.js +152 -0
  92. package/dist/utils/http.d.ts +0 -2
  93. package/dist/utils/http.d.ts.map +1 -1
  94. package/dist/utils/http.js +19 -34
  95. package/dist/utils/markdown.d.ts.map +1 -1
  96. package/dist/utils/markdown.js +115 -39
  97. package/dist/vite-plugin.d.ts +2 -0
  98. package/dist/vite-plugin.d.ts.map +1 -1
  99. package/dist/vite-plugin.js +71 -1
  100. package/package.json +11 -5
package/README.md CHANGED
@@ -12,6 +12,8 @@ No dashboard. No runtime. No API calls to render your own documentation.
12
12
  [![license](https://img.shields.io/npm/l/sourcey)](LICENSE)
13
13
  [![Go Reference](https://pkg.go.dev/badge/github.com/sourcey/sourcey/go/sourcey-godoc.svg)](https://pkg.go.dev/github.com/sourcey/sourcey/go/sourcey-godoc)
14
14
  [![Go Report Card](https://goreportcard.com/badge/github.com/sourcey/sourcey/go/sourcey-godoc)](https://goreportcard.com/report/github.com/sourcey/sourcey/go/sourcey-godoc)
15
+ [![crates.io](https://img.shields.io/crates/v/sourcey.svg)](https://crates.io/crates/sourcey)
16
+ [![docs.rs](https://docs.rs/sourcey/badge.svg)](https://docs.rs/sourcey)
15
17
 
16
18
  ```bash
17
19
  npx sourcey init
@@ -27,9 +29,11 @@ npx sourcey init
27
29
  - **API reference from OpenAPI**: endpoints, parameters, request/response schemas, auto-generated code samples in 10 languages (cURL, JavaScript, TypeScript, Python, Go, Ruby, Java, PHP, Rust, C#)
28
30
  - **MCP server documentation**: tools, resources, prompts rendered as browsable reference with JSON-RPC, TypeScript, and Python code samples. Color-coded method types, annotation badges, connection config cards
29
31
  - **Rich guides**: markdown pages with steps, cards, accordions, syntax-highlighted code blocks, and prose alongside your API reference
32
+ - **MkDocs source import**: point a tab at `mkdocs.yml`; Sourcey reads `docs_dir` and `nav` so existing MkDocs markdown sites can render without hand-copying the sidebar structure
30
33
  - **Product story pages**: changelog, roadmap pages, examples, reference material, search, and portable context exports in one source-owned site
31
- - **C++ and Doxygen**: feed Doxygen XML output, get modern searchable API docs. No new parser, no four-tool Breathe/Exhale/Sphinx pipeline
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
32
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
33
37
  - **Context exports**: auto-generate llms.txt and llms-full.txt alongside your HTML as alternate views of the same documentation graph
34
38
  - **TypeScript config**: `sourcey.config.ts` with `defineConfig()` autocomplete; theme, navbar, CTA buttons, footer
35
39
  - **Theme presets**: default (sidebar + TOC), minimal (single column), api-first (Stripe-style three column); colors, fonts, layout dimensions, and custom CSS on top
@@ -43,14 +47,14 @@ npx sourcey init
43
47
 
44
48
  ### Sourcey CLI
45
49
 
46
- The full Sourcey binary handles OpenAPI, Doxygen, godoc, MCP, and Markdown sources.
50
+ The full Sourcey binary handles OpenAPI, MCP, Doxygen, godoc, rustdoc, MkDocs, and Markdown sources.
47
51
 
48
- | Path | Command | Requires |
49
- |----------|----------------------------------------------------|-------------------|
50
- | npm | `npm install -g sourcey` | Node 20+ |
51
- | Homebrew | `brew tap sourcey/tap && brew install sourcey` | macOS / Linuxbrew |
52
- | Docker | `docker run -v "$PWD":/docs sourcey/sourcey` | Docker |
53
- | Nix | `nix run github:sourcey/sourcey` | Nix (flakes) |
52
+ | Path | Command | Requires |
53
+ | -------- | ---------------------------------------------- | ----------------- |
54
+ | npm | `npm install -g sourcey` | Node 20+ |
55
+ | Homebrew | `brew tap sourcey/tap && brew install sourcey` | macOS / Linuxbrew |
56
+ | Docker | `docker run -v "$PWD":/docs sourcey/sourcey` | Docker |
57
+ | Nix | `nix run github:sourcey/sourcey` | Nix (flakes) |
54
58
 
55
59
  Then `sourcey init` to scaffold a new project, or `sourcey build` against an existing one. See [docs/install.md](docs/install.md) for full Docker invocations (`init` / `dev` / `build`), the `--host` flag for containerized dev, Linuxbrew notes, and Nix profile install.
56
60
 
@@ -58,10 +62,10 @@ Then `sourcey init` to scaffold a new project, or `sourcey build` against an exi
58
62
 
59
63
  For Go-only consumers without a JavaScript toolchain, `sourcey-godoc` ships as a separate native binary. It produces static Go docs sites or portable `godoc.json` snapshots.
60
64
 
61
- | Path | Command |
62
- |----------|---------|
63
- | Go | `go install github.com/sourcey/sourcey/go/sourcey-godoc/cmd/sourcey-godoc@latest` |
64
- | Homebrew | `brew install sourcey/tap/sourcey-godoc` |
65
+ | Path | Command |
66
+ | -------- | ------------------------------------------------------------------------------------------------- |
67
+ | Go | `go install github.com/sourcey/sourcey/go/sourcey-godoc/cmd/sourcey-godoc@latest` |
68
+ | Homebrew | `brew install sourcey/tap/sourcey-godoc` |
65
69
  | Scoop | `scoop bucket add sourcey https://github.com/sourcey/scoop-bucket && scoop install sourcey-godoc` |
66
70
 
67
71
  ## Quick start
@@ -82,101 +86,29 @@ sourcey dev
82
86
  Create `sourcey.config.ts` in your project root:
83
87
 
84
88
  ```typescript
85
- import { defineConfig } from "sourcey";
89
+ import { defineConfig, openapi } from "sourcey";
86
90
 
87
91
  export default defineConfig({
88
92
  name: "My API",
89
- theme: {
90
- preset: "default", // "default" | "minimal" | "api-first"
91
- colors: {
92
- primary: "#6366F1",
93
- light: "#818CF8",
94
- dark: "#4F46E5",
95
- },
96
- },
97
- logo: "./logo.png",
98
93
  navigation: {
99
- tabs: [
100
- {
101
- tab: "Documentation",
102
- groups: [
103
- {
104
- group: "Getting Started",
105
- pages: ["introduction", "quickstart", "authentication"],
106
- },
107
- ],
108
- },
109
- {
110
- tab: "API Reference",
111
- openapi: "./openapi.yaml",
112
- },
113
- {
114
- tab: "MCP Server",
115
- mcp: "./mcp.json",
116
- },
117
- ],
118
- },
119
- navbar: {
120
- links: [{ type: "github", href: "https://github.com/you/repo" }],
121
- primary: { type: "button", label: "Dashboard", href: "https://app.example.com" },
122
- },
123
- footer: {
124
- socials: { github: "https://github.com/you/repo" },
94
+ tabs: [{ tab: "API Reference", source: openapi("./openapi.yaml") }],
125
95
  },
126
96
  });
127
97
  ```
128
98
 
129
- Each tab is an `openapi` spec, an `mcp` snapshot, a `doxygen` directory, a `godoc` Go module, or `groups` of markdown pages. Pages are referenced by slug (e.g. `"quickstart"` resolves to `quickstart.md`).
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.
130
100
 
131
101
  ### Go documentation (godoc)
132
102
 
133
- Add a Go module as a tab and Sourcey extracts package docs natively (no Doxygen pipeline):
134
-
135
- ```typescript
136
- {
137
- tab: "Go API",
138
- godoc: {
139
- module: ".",
140
- packages: ["./internal/core/...", "./cmd/..."],
141
- // sourceBasePath: "go/my-module" // repo-relative prefix for source links when module is not at repo root
142
- // mode: "auto" // default; live when Go is available, snapshot otherwise
143
- // includeTests: true // examples from *_test.go (default)
144
- // includeUnexported: false // hide unexported symbols (default)
145
- },
146
- }
147
- ```
148
-
149
- The string shorthand is `godoc: "."` and expands to `{ module: ".", packages: ["./..."], mode: "auto", includeTests: true }`.
150
-
151
- `editBasePath` remains the global base for Markdown "Edit this page" links.
152
- Use `godoc.sourceBasePath` only when Go source files live under a different
153
- repository prefix than the docs source.
103
+ Render Go package docs as a tab inside your Sourcey site, branded and styled with the rest of your documentation. Native toolchain extraction (`go list` + `go/parser` + `go/doc`) feeds the same renderer as your OpenAPI, MCP, and Markdown tabs, so signatures, examples from `*_test.go`, and source links sit alongside your guides instead of bouncing readers to pkg.go.dev.
154
104
 
155
- Live mode invokes `go list` + `go/parser` + `go/doc` against the host Go toolchain. To pin a build environment for reproducibility, set `goEnv: { GOOS, GOARCH, tags }`.
156
-
157
- Snapshot mode reads a committed `godoc.json` and needs no Go on the build host. Generate it with:
158
-
159
- ```bash
160
- sourcey godoc --module . --packages './...' --out docs/godoc.json
161
- ```
162
-
163
- then point the tab at it:
105
+ **[Live: scafld's Go API reference →](https://0state.com/scafld/docs/go-api)**
164
106
 
165
107
  ```typescript
166
- {
167
- tab: "Go API",
168
- godoc: { mode: "snapshot", snapshot: "./docs/godoc.json" },
169
- }
108
+ { tab: "Go API", source: godoc(".") }
170
109
  ```
171
110
 
172
- The extractor is also a standalone Go CLI for projects that want a native Go
173
- docs generator without installing the full Sourcey npm package:
174
-
175
- ```bash
176
- go install github.com/sourcey/sourcey/go/sourcey-godoc/cmd/sourcey-godoc@latest
177
- sourcey-godoc generate --module . --packages './...' --out site
178
- sourcey-godoc snapshot --module . --packages './...' --out docs/godoc.json
179
- ```
111
+ The shorthand expands to `{ module: ".", packages: ["./..."], mode: "auto", includeTests: true }`. Live mode uses the host Go toolchain; snapshot mode reads a committed `godoc.json` and needs no Go on the build host. See [docs/configuration.md](docs/configuration.md) for `packages`, `mode`, `goEnv`, `sourceBasePath`, and `includeUnexported`.
180
112
 
181
113
  ### Markdown components
182
114
 
@@ -226,12 +158,7 @@ sourcey godoc --out godoc.json Snapshot a Go module's docs to JSON
226
158
  sourcey-godoc generate --out site Standalone Go CLI for static godoc sites
227
159
  ```
228
160
 
229
- | Command | Flag | Description |
230
- | --- | --- | --- |
231
- | `build` | `--output, -o` | Output directory (default: `dist`) |
232
- | `build` | `--embed, -e` | Embeddable output (no html/body wrapper) |
233
- | `build` | `--quiet, -q` | Suppress output |
234
- | `dev` | `--port, -p` | Dev server port (default: `4400`) |
161
+ Run `sourcey <command> --help` for flags.
235
162
 
236
163
  ## Development
237
164
 
@@ -0,0 +1,12 @@
1
+ import type { DoxygenSourceOptions, GodocSourceOptions, MarkdownSourceOptions, McpSourceOptions, MkDocsSourceOptions, OpenApiSourceOptions, RustdocSourceOptions, SourceAdapter } from "./types.js";
2
+ import { assertLocalPath } from "./shared.js";
3
+ export declare function openapi(specOrOptions: string | OpenApiSourceOptions): SourceAdapter;
4
+ export declare function mcp(specOrOptions: string | McpSourceOptions): SourceAdapter;
5
+ export declare function markdown(options: MarkdownSourceOptions): SourceAdapter;
6
+ export declare function mkdocs(configOrOptions: string | MkDocsSourceOptions): SourceAdapter;
7
+ export declare function doxygen(options: DoxygenSourceOptions): SourceAdapter;
8
+ export declare function godoc(configOrPath: GodocSourceOptions): SourceAdapter;
9
+ export declare function rustdoc(configOrPath: RustdocSourceOptions): SourceAdapter;
10
+ export { assertLocalPath };
11
+ export type { DoxygenSourceOptions, GodocSourceOptions, MarkdownSourceOptions, McpSourceOptions, MkDocsSourceOptions, OpenApiSourceOptions, PageMarkdownOptions, ResolvedTabSource, RustdocSourceOptions, SourceAdapter, SourceAdapterContext, } from "./types.js";
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,130 @@
1
+ import { assertLocalPath, resolveMarkdownGroups, toWatchPaths } from "./shared.js";
2
+ import { mkdocs as mkdocsAdapter } from "./mkdocs.js";
3
+ export function openapi(specOrOptions) {
4
+ const spec = typeof specOrOptions === "string" ? specOrOptions : specOrOptions.spec;
5
+ return {
6
+ name: "openapi",
7
+ async resolve(ctx) {
8
+ if (ctx.isUrl(spec)) {
9
+ return { kind: "openapi", spec };
10
+ }
11
+ const absPath = ctx.resolvePath(spec);
12
+ await ctx.assertExists(absPath, `OpenAPI spec "${spec}" in tab "${ctx.tabName}"`);
13
+ return { kind: "openapi", spec: absPath, watchPaths: [absPath] };
14
+ },
15
+ };
16
+ }
17
+ export function mcp(specOrOptions) {
18
+ const spec = typeof specOrOptions === "string" ? specOrOptions : specOrOptions.spec;
19
+ return {
20
+ name: "mcp",
21
+ async resolve(ctx) {
22
+ if (ctx.isUrl(spec)) {
23
+ return { kind: "mcp", spec };
24
+ }
25
+ const absPath = ctx.resolvePath(spec);
26
+ await ctx.assertExists(absPath, `MCP spec "${spec}" in tab "${ctx.tabName}"`);
27
+ return { kind: "mcp", spec: absPath, watchPaths: [absPath] };
28
+ },
29
+ };
30
+ }
31
+ export function markdown(options) {
32
+ return {
33
+ name: "markdown",
34
+ async resolve(ctx) {
35
+ return {
36
+ kind: "markdown",
37
+ adapter: "markdown",
38
+ groups: await resolveMarkdownGroups(options.groups, ctx.tabName, ctx.configDir),
39
+ };
40
+ },
41
+ };
42
+ }
43
+ export function mkdocs(configOrOptions) {
44
+ const options = typeof configOrOptions === "string" ? { config: configOrOptions } : configOrOptions;
45
+ return mkdocsAdapter(options);
46
+ }
47
+ export function doxygen(options) {
48
+ return {
49
+ name: "doxygen",
50
+ async resolve(ctx) {
51
+ const absXml = assertLocalPath(ctx, options.xml, "Doxygen XML directory");
52
+ await ctx.assertExists(absXml, `Doxygen XML directory "${options.xml}" in tab "${ctx.tabName}"`);
53
+ return {
54
+ kind: "doxygen",
55
+ config: {
56
+ xml: absXml,
57
+ language: options.language ?? "cpp",
58
+ groups: options.groups ?? false,
59
+ index: options.index === false ? "none" : (options.index ?? "auto"),
60
+ sourceUrl: options.sourceUrl,
61
+ },
62
+ watchPaths: [absXml],
63
+ };
64
+ },
65
+ };
66
+ }
67
+ export function godoc(configOrPath) {
68
+ return {
69
+ name: "godoc",
70
+ async resolve(ctx) {
71
+ const cfg = typeof configOrPath === "string" ? { module: configOrPath } : configOrPath;
72
+ const moduleAbs = assertLocalPath(ctx, cfg.module ?? ".", "Go module directory");
73
+ await ctx.assertExists(moduleAbs, `Go module directory "${cfg.module ?? "."}" in tab "${ctx.tabName}"`);
74
+ const snapshotAbs = cfg.snapshot ? ctx.resolvePath(cfg.snapshot) : undefined;
75
+ return {
76
+ kind: "godoc",
77
+ config: {
78
+ module: moduleAbs,
79
+ packages: cfg.packages?.length ? cfg.packages : ["./..."],
80
+ snapshot: snapshotAbs,
81
+ mode: cfg.mode ?? "auto",
82
+ includeTests: cfg.includeTests ?? true,
83
+ includeUnexported: cfg.includeUnexported ?? false,
84
+ hideUndocumented: cfg.hideUndocumented ?? false,
85
+ exclude: cfg.exclude ?? [],
86
+ goEnv: cfg.goEnv,
87
+ sourceBasePath: trimSlashes(cfg.sourceBasePath ?? ""),
88
+ },
89
+ watchPaths: toWatchPaths([snapshotAbs]),
90
+ };
91
+ },
92
+ };
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
+ }
127
+ function trimSlashes(value) {
128
+ return value.replace(/^\/+|\/+$/g, "");
129
+ }
130
+ export { assertLocalPath };
@@ -0,0 +1,5 @@
1
+ import type { MarkdownPreprocessor } from "../core/markdown-loader.js";
2
+ import type { MkDocsSourceOptions, SourceAdapter } from "./types.js";
3
+ export declare function mkdocs(options: MkDocsSourceOptions): SourceAdapter;
4
+ export declare const preprocessMkDocsMarkdown: MarkdownPreprocessor;
5
+ //# sourceMappingURL=mkdocs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mkdocs.d.ts","sourceRoot":"","sources":["../../src/adapters/mkdocs.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAcrE,wBAAgB,MAAM,CAAC,OAAO,EAAE,mBAAmB,GAAG,aAAa,CAoBlE;AAiLD,eAAO,MAAM,wBAAwB,EAAE,oBAWtC,CAAC"}