sourcey 3.5.9 → 3.6.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/README.md +28 -117
- package/dist/adapters/index.d.ts +11 -0
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/index.js +98 -0
- package/dist/adapters/mkdocs.d.ts +5 -0
- package/dist/adapters/mkdocs.d.ts.map +1 -0
- package/dist/adapters/mkdocs.js +367 -0
- package/dist/adapters/shared.d.ts +12 -0
- package/dist/adapters/shared.d.ts.map +1 -0
- package/dist/adapters/shared.js +134 -0
- package/dist/adapters/types.d.ts +68 -0
- package/dist/adapters/types.d.ts.map +1 -0
- package/dist/adapters/types.js +1 -0
- package/dist/client/search.js +77 -8
- package/dist/client/sidebar.js +169 -0
- package/dist/components/layout/Head.js +16 -3
- package/dist/components/layout/Sidebar.d.ts.map +1 -1
- package/dist/components/layout/Sidebar.js +1 -1
- package/dist/components/layout/TableOfContents.d.ts.map +1 -1
- package/dist/components/layout/TableOfContents.js +4 -2
- package/dist/config.d.ts +38 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +79 -141
- package/dist/core/doxygen-loader.d.ts.map +1 -1
- package/dist/core/doxygen-loader.js +2 -0
- package/dist/core/markdown-loader.d.ts +14 -0
- package/dist/core/markdown-loader.d.ts.map +1 -1
- package/dist/core/markdown-loader.js +63 -22
- package/dist/core/navigation.d.ts.map +1 -1
- package/dist/core/navigation.js +8 -7
- package/dist/core/search-indexer.d.ts +10 -0
- package/dist/core/search-indexer.d.ts.map +1 -1
- package/dist/core/search-indexer.js +5 -0
- package/dist/dev-server.d.ts.map +1 -1
- package/dist/dev-server.js +60 -33
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +19 -14
- package/dist/site-assembly.d.ts.map +1 -1
- package/dist/site-assembly.js +107 -25
- package/dist/utils/markdown.d.ts.map +1 -1
- package/dist/utils/markdown.js +15 -4
- package/dist/vite-plugin.d.ts +2 -0
- package/dist/vite-plugin.d.ts.map +1 -1
- package/dist/vite-plugin.js +71 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
# Sourcey
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> Docs straight from the source.
|
|
4
4
|
|
|
5
|
-
Sourcey
|
|
5
|
+
Sourcey tells the whole product story. It turns specs, code, rich guides, changelog, roadmap pages, examples, and portable context files from your project into static HTML you can deploy anywhere.
|
|
6
|
+
|
|
7
|
+
No dashboard. No runtime. No API calls to render your own documentation.
|
|
6
8
|
|
|
7
9
|
[](https://www.npmjs.com/package/sourcey)
|
|
8
10
|
[](https://github.com/sourcey/sourcey/actions)
|
|
@@ -17,17 +19,19 @@ npx sourcey init
|
|
|
17
19
|
|
|
18
20
|

|
|
19
21
|
|
|
20
|
-
**[Live demo](https://
|
|
22
|
+
**[Live demo](https://sourcey.com/cheesestore)** · [Documentation](https://sourcey.com/docs) · [GitHub](https://github.com/sourcey/sourcey)
|
|
21
23
|
|
|
22
24
|
## Features
|
|
23
25
|
|
|
24
26
|
- **OpenAPI 2.0, 3.0, 3.1, and 3.2**: full spec coverage including `QUERY` operations, response summaries, hierarchical tags, `deviceAuthorization` OAuth, `querystring` parameters, and `$self`-aware refs for multi-document APIs
|
|
25
27
|
- **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#)
|
|
26
28
|
- **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
|
|
27
|
-
- **
|
|
28
|
-
- **
|
|
29
|
+
- **Rich guides**: markdown pages with steps, cards, accordions, syntax-highlighted code blocks, and prose alongside your API reference
|
|
30
|
+
- **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
|
|
31
|
+
- **Product story pages**: changelog, roadmap pages, examples, reference material, search, and portable context exports in one source-owned site
|
|
32
|
+
- **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
|
|
29
33
|
- **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
|
|
30
|
-
- **
|
|
34
|
+
- **Context exports**: auto-generate llms.txt and llms-full.txt alongside your HTML as alternate views of the same documentation graph
|
|
31
35
|
- **TypeScript config**: `sourcey.config.ts` with `defineConfig()` autocomplete; theme, navbar, CTA buttons, footer
|
|
32
36
|
- **Theme presets**: default (sidebar + TOC), minimal (single column), api-first (Stripe-style three column); colors, fonts, layout dimensions, and custom CSS on top
|
|
33
37
|
- **Vite dev server**: SSR hot reload on every component and CSS change; spec and markdown changes trigger instant refresh
|
|
@@ -36,34 +40,18 @@ npx sourcey init
|
|
|
36
40
|
- **Static HTML output**: no framework runtime, no vendor lock-in. Deploy to GitHub Pages, Vercel, Netlify, S3, anywhere
|
|
37
41
|
- **Open source**: AGPL-3.0. Self-host, fork, extend. Your docs, your infrastructure
|
|
38
42
|
|
|
39
|
-
### Sourcey vs alternatives
|
|
40
|
-
|
|
41
|
-
| | Sourcey | Redocly | GitBook | Mintlify | Fern | ReadMe |
|
|
42
|
-
|---|---|---|---|---|---|---|
|
|
43
|
-
| Open source | Yes | Partial | No | No | No | No |
|
|
44
|
-
| Static output | Yes | Yes | No | No | No | No |
|
|
45
|
-
| Zero JS shipped | Yes | No | No | No | No | No |
|
|
46
|
-
| MCP server docs | Native | No | No | No | No | No |
|
|
47
|
-
| Doxygen / C++ docs | Native | No | No | No | No | No |
|
|
48
|
-
| godoc / Go docs | Native | No | No | No | No | No |
|
|
49
|
-
| Config format | TypeScript | YAML | GUI | JSON | YAML | GUI |
|
|
50
|
-
| Local preview | Vite SSR | Local | Hosted | Local | Local | Hosted |
|
|
51
|
-
| No account required | Yes | Partial | No | No | No | No |
|
|
52
|
-
| Self-hosted | Yes | Yes | No | No | Yes | No |
|
|
53
|
-
| Pricing | Free | $10–$24 | $65–$249 | $250+ | $150+ | $79–$3,000+ |
|
|
54
|
-
|
|
55
43
|
## Install
|
|
56
44
|
|
|
57
45
|
### Sourcey CLI
|
|
58
46
|
|
|
59
47
|
The full Sourcey binary handles OpenAPI, Doxygen, godoc, MCP, and Markdown sources.
|
|
60
48
|
|
|
61
|
-
| Path | Command
|
|
62
|
-
|
|
63
|
-
| npm | `npm install -g sourcey`
|
|
64
|
-
| Homebrew | `brew tap sourcey/tap && brew install sourcey`
|
|
65
|
-
| Docker | `docker run -v "$PWD":/docs sourcey/sourcey`
|
|
66
|
-
| Nix | `nix run github:sourcey/sourcey`
|
|
49
|
+
| Path | Command | Requires |
|
|
50
|
+
| -------- | ---------------------------------------------- | ----------------- |
|
|
51
|
+
| npm | `npm install -g sourcey` | Node 20+ |
|
|
52
|
+
| Homebrew | `brew tap sourcey/tap && brew install sourcey` | macOS / Linuxbrew |
|
|
53
|
+
| Docker | `docker run -v "$PWD":/docs sourcey/sourcey` | Docker |
|
|
54
|
+
| Nix | `nix run github:sourcey/sourcey` | Nix (flakes) |
|
|
67
55
|
|
|
68
56
|
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.
|
|
69
57
|
|
|
@@ -71,10 +59,10 @@ Then `sourcey init` to scaffold a new project, or `sourcey build` against an exi
|
|
|
71
59
|
|
|
72
60
|
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.
|
|
73
61
|
|
|
74
|
-
| Path | Command
|
|
75
|
-
|
|
76
|
-
| Go | `go install github.com/sourcey/sourcey/go/sourcey-godoc/cmd/sourcey-godoc@latest`
|
|
77
|
-
| Homebrew | `brew install sourcey/tap/sourcey-godoc`
|
|
62
|
+
| Path | Command |
|
|
63
|
+
| -------- | ------------------------------------------------------------------------------------------------- |
|
|
64
|
+
| Go | `go install github.com/sourcey/sourcey/go/sourcey-godoc/cmd/sourcey-godoc@latest` |
|
|
65
|
+
| Homebrew | `brew install sourcey/tap/sourcey-godoc` |
|
|
78
66
|
| Scoop | `scoop bucket add sourcey https://github.com/sourcey/scoop-bucket && scoop install sourcey-godoc` |
|
|
79
67
|
|
|
80
68
|
## Quick start
|
|
@@ -95,101 +83,29 @@ sourcey dev
|
|
|
95
83
|
Create `sourcey.config.ts` in your project root:
|
|
96
84
|
|
|
97
85
|
```typescript
|
|
98
|
-
import { defineConfig } from "sourcey";
|
|
86
|
+
import { defineConfig, openapi } from "sourcey";
|
|
99
87
|
|
|
100
88
|
export default defineConfig({
|
|
101
89
|
name: "My API",
|
|
102
|
-
theme: {
|
|
103
|
-
preset: "default", // "default" | "minimal" | "api-first"
|
|
104
|
-
colors: {
|
|
105
|
-
primary: "#6366F1",
|
|
106
|
-
light: "#818CF8",
|
|
107
|
-
dark: "#4F46E5",
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
logo: "./logo.png",
|
|
111
90
|
navigation: {
|
|
112
|
-
tabs: [
|
|
113
|
-
{
|
|
114
|
-
tab: "Documentation",
|
|
115
|
-
groups: [
|
|
116
|
-
{
|
|
117
|
-
group: "Getting Started",
|
|
118
|
-
pages: ["introduction", "quickstart", "authentication"],
|
|
119
|
-
},
|
|
120
|
-
],
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
tab: "API Reference",
|
|
124
|
-
openapi: "./openapi.yaml",
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
tab: "MCP Server",
|
|
128
|
-
mcp: "./mcp.json",
|
|
129
|
-
},
|
|
130
|
-
],
|
|
131
|
-
},
|
|
132
|
-
navbar: {
|
|
133
|
-
links: [{ type: "github", href: "https://github.com/you/repo" }],
|
|
134
|
-
primary: { type: "button", label: "Dashboard", href: "https://app.example.com" },
|
|
135
|
-
},
|
|
136
|
-
footer: {
|
|
137
|
-
socials: { github: "https://github.com/you/repo" },
|
|
91
|
+
tabs: [{ tab: "API Reference", source: openapi("./openapi.yaml") }],
|
|
138
92
|
},
|
|
139
93
|
});
|
|
140
94
|
```
|
|
141
95
|
|
|
142
|
-
Each tab
|
|
96
|
+
Each tab has one `source`, usually created with `markdown()`, `mkdocs()`, `openapi()`, `mcp()`, `doxygen()`, or `godoc()`. 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.
|
|
143
97
|
|
|
144
98
|
### Go documentation (godoc)
|
|
145
99
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
```typescript
|
|
149
|
-
{
|
|
150
|
-
tab: "Go API",
|
|
151
|
-
godoc: {
|
|
152
|
-
module: ".",
|
|
153
|
-
packages: ["./internal/core/...", "./cmd/..."],
|
|
154
|
-
// sourceBasePath: "go/my-module" // repo-relative prefix for source links when module is not at repo root
|
|
155
|
-
// mode: "auto" // default; live when Go is available, snapshot otherwise
|
|
156
|
-
// includeTests: true // examples from *_test.go (default)
|
|
157
|
-
// includeUnexported: false // hide unexported symbols (default)
|
|
158
|
-
},
|
|
159
|
-
}
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
The string shorthand is `godoc: "."` and expands to `{ module: ".", packages: ["./..."], mode: "auto", includeTests: true }`.
|
|
100
|
+
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.
|
|
163
101
|
|
|
164
|
-
|
|
165
|
-
Use `godoc.sourceBasePath` only when Go source files live under a different
|
|
166
|
-
repository prefix than the docs source.
|
|
167
|
-
|
|
168
|
-
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 }`.
|
|
169
|
-
|
|
170
|
-
Snapshot mode reads a committed `godoc.json` and needs no Go on the build host. Generate it with:
|
|
171
|
-
|
|
172
|
-
```bash
|
|
173
|
-
sourcey godoc --module . --packages './...' --out docs/godoc.json
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
then point the tab at it:
|
|
102
|
+
**[Live: scafld's Go API reference →](https://0state.com/scafld/docs/go-api)**
|
|
177
103
|
|
|
178
104
|
```typescript
|
|
179
|
-
{
|
|
180
|
-
tab: "Go API",
|
|
181
|
-
godoc: { mode: "snapshot", snapshot: "./docs/godoc.json" },
|
|
182
|
-
}
|
|
105
|
+
{ tab: "Go API", source: godoc(".") }
|
|
183
106
|
```
|
|
184
107
|
|
|
185
|
-
The
|
|
186
|
-
docs generator without installing the full Sourcey npm package:
|
|
187
|
-
|
|
188
|
-
```bash
|
|
189
|
-
go install github.com/sourcey/sourcey/go/sourcey-godoc/cmd/sourcey-godoc@latest
|
|
190
|
-
sourcey-godoc generate --module . --packages './...' --out site
|
|
191
|
-
sourcey-godoc snapshot --module . --packages './...' --out docs/godoc.json
|
|
192
|
-
```
|
|
108
|
+
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`.
|
|
193
109
|
|
|
194
110
|
### Markdown components
|
|
195
111
|
|
|
@@ -239,12 +155,7 @@ sourcey godoc --out godoc.json Snapshot a Go module's docs to JSON
|
|
|
239
155
|
sourcey-godoc generate --out site Standalone Go CLI for static godoc sites
|
|
240
156
|
```
|
|
241
157
|
|
|
242
|
-
|
|
243
|
-
| --- | --- | --- |
|
|
244
|
-
| `build` | `--output, -o` | Output directory (default: `dist`) |
|
|
245
|
-
| `build` | `--embed, -e` | Embeddable output (no html/body wrapper) |
|
|
246
|
-
| `build` | `--quiet, -q` | Suppress output |
|
|
247
|
-
| `dev` | `--port, -p` | Dev server port (default: `4400`) |
|
|
158
|
+
Run `sourcey <command> --help` for flags.
|
|
248
159
|
|
|
249
160
|
## Development
|
|
250
161
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DoxygenSourceOptions, GodocSourceOptions, MarkdownSourceOptions, McpSourceOptions, MkDocsSourceOptions, OpenApiSourceOptions, 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 { assertLocalPath };
|
|
10
|
+
export type { DoxygenSourceOptions, GodocSourceOptions, MarkdownSourceOptions, McpSourceOptions, MkDocsSourceOptions, OpenApiSourceOptions, PageMarkdownOptions, ResolvedTabSource, SourceAdapter, SourceAdapterContext, } from "./types.js";
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EACpB,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,EACnB,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;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,aAAa,EACb,oBAAoB,GACrB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { resolve } from "node:path";
|
|
2
|
+
import { assertLocalPath, resolveMarkdownGroups, toWatchPaths } from "./shared.js";
|
|
3
|
+
import { mkdocs as mkdocsAdapter } from "./mkdocs.js";
|
|
4
|
+
export function openapi(specOrOptions) {
|
|
5
|
+
const spec = typeof specOrOptions === "string" ? specOrOptions : specOrOptions.spec;
|
|
6
|
+
return {
|
|
7
|
+
name: "openapi",
|
|
8
|
+
async resolve(ctx) {
|
|
9
|
+
if (ctx.isUrl(spec)) {
|
|
10
|
+
return { kind: "openapi", spec };
|
|
11
|
+
}
|
|
12
|
+
const absPath = ctx.resolvePath(spec);
|
|
13
|
+
await ctx.assertExists(absPath, `OpenAPI spec "${spec}" in tab "${ctx.tabName}"`);
|
|
14
|
+
return { kind: "openapi", spec: absPath, watchPaths: [absPath] };
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export function mcp(specOrOptions) {
|
|
19
|
+
const spec = typeof specOrOptions === "string" ? specOrOptions : specOrOptions.spec;
|
|
20
|
+
return {
|
|
21
|
+
name: "mcp",
|
|
22
|
+
async resolve(ctx) {
|
|
23
|
+
if (ctx.isUrl(spec)) {
|
|
24
|
+
return { kind: "mcp", spec };
|
|
25
|
+
}
|
|
26
|
+
const absPath = ctx.resolvePath(spec);
|
|
27
|
+
await ctx.assertExists(absPath, `MCP spec "${spec}" in tab "${ctx.tabName}"`);
|
|
28
|
+
return { kind: "mcp", spec: absPath, watchPaths: [absPath] };
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export function markdown(options) {
|
|
33
|
+
return {
|
|
34
|
+
name: "markdown",
|
|
35
|
+
async resolve(ctx) {
|
|
36
|
+
return {
|
|
37
|
+
kind: "markdown",
|
|
38
|
+
adapter: "markdown",
|
|
39
|
+
groups: await resolveMarkdownGroups(options.groups, ctx.tabName, ctx.configDir),
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export function mkdocs(configOrOptions) {
|
|
45
|
+
const options = typeof configOrOptions === "string" ? { config: configOrOptions } : configOrOptions;
|
|
46
|
+
return mkdocsAdapter(options);
|
|
47
|
+
}
|
|
48
|
+
export function doxygen(options) {
|
|
49
|
+
return {
|
|
50
|
+
name: "doxygen",
|
|
51
|
+
async resolve(ctx) {
|
|
52
|
+
const absXml = ctx.resolvePath(options.xml);
|
|
53
|
+
await ctx.assertExists(absXml, `Doxygen XML directory "${options.xml}" in tab "${ctx.tabName}"`);
|
|
54
|
+
return {
|
|
55
|
+
kind: "doxygen",
|
|
56
|
+
config: {
|
|
57
|
+
xml: absXml,
|
|
58
|
+
language: options.language ?? "cpp",
|
|
59
|
+
groups: options.groups ?? false,
|
|
60
|
+
index: options.index === false ? "none" : (options.index ?? "auto"),
|
|
61
|
+
sourceUrl: options.sourceUrl,
|
|
62
|
+
},
|
|
63
|
+
watchPaths: [absXml],
|
|
64
|
+
};
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
export function godoc(configOrPath) {
|
|
69
|
+
return {
|
|
70
|
+
name: "godoc",
|
|
71
|
+
async resolve(ctx) {
|
|
72
|
+
const cfg = typeof configOrPath === "string" ? { module: configOrPath } : configOrPath;
|
|
73
|
+
const moduleAbs = resolve(ctx.configDir, cfg.module ?? ".");
|
|
74
|
+
await ctx.assertExists(moduleAbs, `Go module directory "${cfg.module ?? "."}" in tab "${ctx.tabName}"`);
|
|
75
|
+
const snapshotAbs = cfg.snapshot ? ctx.resolvePath(cfg.snapshot) : undefined;
|
|
76
|
+
return {
|
|
77
|
+
kind: "godoc",
|
|
78
|
+
config: {
|
|
79
|
+
module: moduleAbs,
|
|
80
|
+
packages: cfg.packages?.length ? cfg.packages : ["./..."],
|
|
81
|
+
snapshot: snapshotAbs,
|
|
82
|
+
mode: cfg.mode ?? "auto",
|
|
83
|
+
includeTests: cfg.includeTests ?? true,
|
|
84
|
+
includeUnexported: cfg.includeUnexported ?? false,
|
|
85
|
+
hideUndocumented: cfg.hideUndocumented ?? false,
|
|
86
|
+
exclude: cfg.exclude ?? [],
|
|
87
|
+
goEnv: cfg.goEnv,
|
|
88
|
+
sourceBasePath: trimSlashes(cfg.sourceBasePath ?? ""),
|
|
89
|
+
},
|
|
90
|
+
watchPaths: toWatchPaths([snapshotAbs]),
|
|
91
|
+
};
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
function trimSlashes(value) {
|
|
96
|
+
return value.replace(/^\/+|\/+$/g, "");
|
|
97
|
+
}
|
|
98
|
+
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"}
|