sourcey 3.5.0 → 3.5.2
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 +90 -10
- package/dist/cli.js +122 -3
- package/dist/components/layout/Page.d.ts.map +1 -1
- package/dist/components/layout/Page.js +4 -1
- package/dist/config.d.ts +60 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +28 -3
- package/dist/core/godoc-introspector.d.ts +26 -0
- package/dist/core/godoc-introspector.d.ts.map +1 -0
- package/dist/core/godoc-introspector.js +144 -0
- package/dist/core/godoc-loader.d.ts +34 -0
- package/dist/core/godoc-loader.d.ts.map +1 -0
- package/dist/core/godoc-loader.js +491 -0
- package/dist/core/godoc-types.d.ts +109 -0
- package/dist/core/godoc-types.d.ts.map +1 -0
- package/dist/core/godoc-types.js +8 -0
- package/dist/core/markdown-loader.d.ts +10 -0
- package/dist/core/markdown-loader.d.ts.map +1 -1
- package/dist/core/navigation.d.ts +3 -2
- package/dist/core/navigation.d.ts.map +1 -1
- package/dist/core/navigation.js +15 -5
- package/dist/core/search-indexer.d.ts.map +1 -1
- package/dist/core/search-indexer.js +9 -0
- package/dist/core/sourcey-godoc/cmd/sourcey-godoc/main.go +736 -0
- package/dist/core/sourcey-godoc/cmd/sourcey-godoc/site.go +497 -0
- package/dist/core/sourcey-godoc/cmd/sourcey-godoc/site_test.go +89 -0
- package/dist/core/sourcey-godoc/doc.go +11 -0
- package/dist/core/sourcey-godoc/go.mod +3 -0
- package/dist/dev-server.d.ts.map +1 -1
- package/dist/dev-server.js +44 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/site-assembly.d.ts +3 -0
- package/dist/site-assembly.d.ts.map +1 -1
- package/dist/site-assembly.js +33 -4
- package/dist/themes/default/sourcey.css +244 -0
- package/package.json +13 -4
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sourcey-owned data model for native Go documentation.
|
|
3
|
+
*
|
|
4
|
+
* The Go introspector helper emits this shape as JSON; the loader, renderer,
|
|
5
|
+
* search indexer, and llms emitter all read it. The same shape doubles as the
|
|
6
|
+
* snapshot artifact (`godoc.json`) so JS-only docs hosts can build without Go.
|
|
7
|
+
*/
|
|
8
|
+
export declare const GODOC_SCHEMA_VERSION = 1;
|
|
9
|
+
export interface GodocSpec {
|
|
10
|
+
/** Module import path from `go.mod` (e.g. "github.com/acme/project"). */
|
|
11
|
+
modulePath: string;
|
|
12
|
+
/** Absolute filesystem path to the module root (containing go.mod). */
|
|
13
|
+
moduleDir: string;
|
|
14
|
+
/** ISO-8601 timestamp recorded by the introspector. */
|
|
15
|
+
generatedAt?: string;
|
|
16
|
+
packages: GodocPackage[];
|
|
17
|
+
diagnostics: GodocDiagnostic[];
|
|
18
|
+
}
|
|
19
|
+
export interface GodocPackage {
|
|
20
|
+
/** Full import path (e.g. "github.com/acme/project/internal/core"). */
|
|
21
|
+
importPath: string;
|
|
22
|
+
/** Last segment of the import path; the `package` clause name. */
|
|
23
|
+
name: string;
|
|
24
|
+
/** First-sentence summary derived from the package doc comment. */
|
|
25
|
+
synopsis: string;
|
|
26
|
+
/** Full package doc comment, Markdown-ish. */
|
|
27
|
+
doc: string;
|
|
28
|
+
/** Path to the package directory, relative to the module root. */
|
|
29
|
+
dir: string;
|
|
30
|
+
/** Source files contributing to this package (build-tag filtered by `go list`). */
|
|
31
|
+
files: string[];
|
|
32
|
+
consts: GodocValue[];
|
|
33
|
+
vars: GodocValue[];
|
|
34
|
+
funcs: GodocFunc[];
|
|
35
|
+
types: GodocType[];
|
|
36
|
+
examples: GodocExample[];
|
|
37
|
+
}
|
|
38
|
+
export interface GodocValue {
|
|
39
|
+
name: string;
|
|
40
|
+
doc: string;
|
|
41
|
+
/** Source-faithful declaration, e.g. `const StatusDraft Status = "draft"`. */
|
|
42
|
+
declaration: string;
|
|
43
|
+
position?: SourcePosition;
|
|
44
|
+
}
|
|
45
|
+
export interface GodocFunc {
|
|
46
|
+
name: string;
|
|
47
|
+
doc: string;
|
|
48
|
+
/** Full signature, e.g. `func Run(ctx context.Context) error`. */
|
|
49
|
+
signature: string;
|
|
50
|
+
position?: SourcePosition;
|
|
51
|
+
examples: GodocExample[];
|
|
52
|
+
}
|
|
53
|
+
export interface GodocType {
|
|
54
|
+
name: string;
|
|
55
|
+
doc: string;
|
|
56
|
+
/** Source-faithful declaration, including the `type` keyword. */
|
|
57
|
+
declaration: string;
|
|
58
|
+
kind: GodocTypeKind;
|
|
59
|
+
position?: SourcePosition;
|
|
60
|
+
fields: GodocField[];
|
|
61
|
+
methods: GodocFunc[];
|
|
62
|
+
examples: GodocExample[];
|
|
63
|
+
}
|
|
64
|
+
export type GodocTypeKind = "struct" | "interface" | "alias" | "defined" | "unknown";
|
|
65
|
+
export interface GodocField {
|
|
66
|
+
name: string;
|
|
67
|
+
doc: string;
|
|
68
|
+
type: string;
|
|
69
|
+
tag?: string;
|
|
70
|
+
embedded?: boolean;
|
|
71
|
+
}
|
|
72
|
+
export interface GodocExample {
|
|
73
|
+
/** Bare example name without the `Example` prefix or function suffix. */
|
|
74
|
+
name: string;
|
|
75
|
+
/** `Suffix` portion of `ExampleFoo_Suffix`; empty for the base example. */
|
|
76
|
+
suffix: string;
|
|
77
|
+
doc: string;
|
|
78
|
+
code: string;
|
|
79
|
+
/** Expected output captured from `// Output:` directives. */
|
|
80
|
+
output?: string;
|
|
81
|
+
}
|
|
82
|
+
export interface SourcePosition {
|
|
83
|
+
/** Path relative to the module root, slash-separated. */
|
|
84
|
+
file: string;
|
|
85
|
+
line: number;
|
|
86
|
+
}
|
|
87
|
+
export interface GodocDiagnostic {
|
|
88
|
+
severity: "error" | "warning" | "info";
|
|
89
|
+
/** Stable diagnostic code (e.g. `GODOC_PACKAGE_PARSE_FAILED`). */
|
|
90
|
+
code: string;
|
|
91
|
+
message: string;
|
|
92
|
+
package?: string;
|
|
93
|
+
file?: string;
|
|
94
|
+
line?: number;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* On-disk snapshot envelope. Keeps `schema_version` separate from the spec
|
|
98
|
+
* payload so future versions can add fields or migrate without breaking
|
|
99
|
+
* older readers.
|
|
100
|
+
*/
|
|
101
|
+
export interface GodocSnapshot {
|
|
102
|
+
schema_version: number;
|
|
103
|
+
source: "sourcey-godoc";
|
|
104
|
+
module_path: string;
|
|
105
|
+
packages: GodocPackage[];
|
|
106
|
+
generated_at?: string;
|
|
107
|
+
diagnostics?: GodocDiagnostic[];
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=godoc-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"godoc-types.d.ts","sourceRoot":"","sources":["../../src/core/godoc-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAEtC,MAAM,WAAW,SAAS;IACxB,yEAAyE;IACzE,UAAU,EAAE,MAAM,CAAC;IACnB,uEAAuE;IACvE,SAAS,EAAE,MAAM,CAAC;IAClB,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,WAAW,EAAE,eAAe,EAAE,CAAC;CAChC;AAED,MAAM,WAAW,YAAY;IAC3B,uEAAuE;IACvE,UAAU,EAAE,MAAM,CAAC;IACnB,kEAAkE;IAClE,IAAI,EAAE,MAAM,CAAC;IACb,mEAAmE;IACnE,QAAQ,EAAE,MAAM,CAAC;IACjB,8CAA8C;IAC9C,GAAG,EAAE,MAAM,CAAC;IACZ,kEAAkE;IAClE,GAAG,EAAE,MAAM,CAAC;IACZ,mFAAmF;IACnF,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,IAAI,EAAE,UAAU,EAAE,CAAC;IACnB,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,KAAK,EAAE,SAAS,EAAE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AE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,yDAAyD;IACzD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;IACvC,kEAAkE;IAClE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,eAAe,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,eAAe,EAAE,CAAC;CACjC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sourcey-owned data model for native Go documentation.
|
|
3
|
+
*
|
|
4
|
+
* The Go introspector helper emits this shape as JSON; the loader, renderer,
|
|
5
|
+
* search indexer, and llms emitter all read it. The same shape doubles as the
|
|
6
|
+
* snapshot artifact (`godoc.json`) so JS-only docs hosts can build without Go.
|
|
7
|
+
*/
|
|
8
|
+
export const GODOC_SCHEMA_VERSION = 1;
|
|
@@ -16,6 +16,16 @@ export interface MarkdownPage {
|
|
|
16
16
|
sourcePath: string;
|
|
17
17
|
/** Optional repo-relative path used for "Edit this page" links. Null disables the link. */
|
|
18
18
|
editPath?: string | null;
|
|
19
|
+
/** Optional base path override for this page's edit link. Undefined uses the site default. */
|
|
20
|
+
editBasePath?: string | null;
|
|
21
|
+
/** Optional page-local entries that should be indexed in addition to headings. */
|
|
22
|
+
searchEntries?: PageSearchEntry[];
|
|
23
|
+
}
|
|
24
|
+
export interface PageSearchEntry {
|
|
25
|
+
title: string;
|
|
26
|
+
content: string;
|
|
27
|
+
anchor?: string;
|
|
28
|
+
category: string;
|
|
19
29
|
}
|
|
20
30
|
export interface ChangelogPage {
|
|
21
31
|
kind: "changelog";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-loader.d.ts","sourceRoot":"","sources":["../../src/core/markdown-loader.ts"],"names":[],"mappings":"AAMA,OAAO,EAKL,KAAK,WAAW,EACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAMtD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,UAAU,CAAC;IACjB,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,WAAW,EAAE,MAAM,CAAC;IACpB,qDAAqD;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,qDAAqD;IACrD,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,sEAAsE;IACtE,UAAU,EAAE,MAAM,CAAC;IACnB,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"markdown-loader.d.ts","sourceRoot":"","sources":["../../src/core/markdown-loader.ts"],"names":[],"mappings":"AAMA,OAAO,EAKL,KAAK,WAAW,EACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAMtD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,UAAU,CAAC;IACjB,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,WAAW,EAAE,MAAM,CAAC;IACpB,qDAAqD;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,qDAAqD;I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,mBAAwB,GAChC,OAAO,CAAC,QAAQ,CAAC,CAiCnB;AAuDD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAIrD"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { NormalizedSpec } from "./types.js";
|
|
2
2
|
import type { ResolvedTab } from "../config.js";
|
|
3
3
|
import type { DocsPage } from "./markdown-loader.js";
|
|
4
|
+
import { type PrettyUrls } from "../site-url.js";
|
|
4
5
|
export interface SiteNavigation {
|
|
5
6
|
tabs: SiteTab[];
|
|
6
7
|
activeTabSlug: string;
|
|
@@ -33,12 +34,12 @@ export interface SiteNavItem {
|
|
|
33
34
|
* Introduction + Authentication → tag groups with operations → Models.
|
|
34
35
|
* All hrefs are #anchor links (single-page spec rendering).
|
|
35
36
|
*/
|
|
36
|
-
export declare function buildNavFromSpec(spec: NormalizedSpec, tabSlug: string): SiteTab;
|
|
37
|
+
export declare function buildNavFromSpec(spec: NormalizedSpec, tabSlug: string, prettyUrls?: PrettyUrls): SiteTab;
|
|
37
38
|
/**
|
|
38
39
|
* Build a navigation tab from markdown pages.
|
|
39
40
|
* Groups come from the config; items come from loaded page data.
|
|
40
41
|
*/
|
|
41
|
-
export declare function buildNavFromPages(tab: ResolvedTab, pagesByPath: Map<string, DocsPage
|
|
42
|
+
export declare function buildNavFromPages(tab: ResolvedTab, pagesByPath: Map<string, DocsPage>, prettyUrls?: PrettyUrls): SiteTab;
|
|
42
43
|
/**
|
|
43
44
|
* Assemble a SiteNavigation from a list of tabs.
|
|
44
45
|
* Defaults to the first tab and first page as active.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/core/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAGjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK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,UAAU,GAAE,UAAkB,GAC7B,OAAO,CA6BT;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,cAAc,CASnE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,GAAG,EAAE,cAAc,EACnB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACf,cAAc,CAEhB"}
|
package/dist/core/navigation.js
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { tagNavigationLabel } from "./tag-utils.js";
|
|
2
|
-
import { tabPath } from "../config.js";
|
|
2
|
+
import { pageOutputPath, tabPath } from "../config.js";
|
|
3
3
|
import { htmlId } from "../utils/html-id.js";
|
|
4
|
+
import { toPublicPath } from "../site-url.js";
|
|
5
|
+
/**
|
|
6
|
+
* Convert a file output path (e.g. `concepts/index.html`) into the relative
|
|
7
|
+
* href the nav should emit, honouring the `prettyUrls` mode. The Sidebar
|
|
8
|
+
* prepends a `../` depth prefix at render time, so the value returned here
|
|
9
|
+
* must be root-relative *without* a leading slash.
|
|
10
|
+
*/
|
|
11
|
+
function navHref(outputPath, prettyUrls) {
|
|
12
|
+
return toPublicPath(outputPath, "", prettyUrls).replace(/^\//, "");
|
|
13
|
+
}
|
|
4
14
|
// ---------------------------------------------------------------------------
|
|
5
15
|
// Builders
|
|
6
16
|
// ---------------------------------------------------------------------------
|
|
@@ -10,8 +20,8 @@ import { htmlId } from "../utils/html-id.js";
|
|
|
10
20
|
* Introduction + Authentication → tag groups with operations → Models.
|
|
11
21
|
* All hrefs are #anchor links (single-page spec rendering).
|
|
12
22
|
*/
|
|
13
|
-
export function buildNavFromSpec(spec, tabSlug) {
|
|
14
|
-
const basePath = tabPath(tabSlug, "index.html");
|
|
23
|
+
export function buildNavFromSpec(spec, tabSlug, prettyUrls = false) {
|
|
24
|
+
const basePath = navHref(tabPath(tabSlug, "index.html"), prettyUrls);
|
|
15
25
|
const groups = [];
|
|
16
26
|
// Intro group
|
|
17
27
|
const introItems = [
|
|
@@ -62,7 +72,7 @@ export function buildNavFromSpec(spec, tabSlug) {
|
|
|
62
72
|
* Build a navigation tab from markdown pages.
|
|
63
73
|
* Groups come from the config; items come from loaded page data.
|
|
64
74
|
*/
|
|
65
|
-
export function buildNavFromPages(tab, pagesByPath) {
|
|
75
|
+
export function buildNavFromPages(tab, pagesByPath, prettyUrls = false) {
|
|
66
76
|
const groups = [];
|
|
67
77
|
if (tab.groups) {
|
|
68
78
|
for (const group of tab.groups) {
|
|
@@ -73,7 +83,7 @@ export function buildNavFromPages(tab, pagesByPath) {
|
|
|
73
83
|
continue;
|
|
74
84
|
items.push({
|
|
75
85
|
label: page.title,
|
|
76
|
-
href:
|
|
86
|
+
href: navHref(pageOutputPath(tab.slug, page.slug, prettyUrls), prettyUrls),
|
|
77
87
|
id: page.slug,
|
|
78
88
|
});
|
|
79
89
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-indexer.d.ts","sourceRoot":"","sources":["../../src/core/search-indexer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAOjD,MAAM,WAAW,WAAW;IAC1B,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,OAAO,EAAE,MAAM,CAAC;IAChB,mDAAmD;IACnD,GAAG,EAAE,MAAM,CAAC;IACZ,qCAAqC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8BAA8B;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gCAAgC;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,oCAAoC;IACpC,QAAQ,EAAE,MAAM,CAA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AAS,SAAM,EACf,aAAa,GAAE,MAAM,EAAO,EAC5B,UAAU,GAAE,UAAkB,GAC7B,MAAM,CAgGR"}
|
|
@@ -73,6 +73,15 @@ export function buildSearchIndex(specs, pages, navigation, assetBase = "/", feat
|
|
|
73
73
|
category: "Sections",
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
|
+
for (const entry of page.searchEntries ?? []) {
|
|
77
|
+
entries.push({
|
|
78
|
+
title: entry.title,
|
|
79
|
+
content: entry.content.slice(0, 500),
|
|
80
|
+
url: entry.anchor ? `${href}#${entry.anchor}` : href,
|
|
81
|
+
tab: tabLabel,
|
|
82
|
+
category: entry.category,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
76
85
|
}
|
|
77
86
|
else {
|
|
78
87
|
for (const version of page.changelog.versions) {
|