sourcey 3.5.1 → 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.
Files changed (35) hide show
  1. package/README.md +90 -10
  2. package/dist/cli.js +122 -3
  3. package/dist/components/layout/Page.d.ts.map +1 -1
  4. package/dist/components/layout/Page.js +4 -1
  5. package/dist/config.d.ts +60 -0
  6. package/dist/config.d.ts.map +1 -1
  7. package/dist/config.js +28 -3
  8. package/dist/core/godoc-introspector.d.ts +26 -0
  9. package/dist/core/godoc-introspector.d.ts.map +1 -0
  10. package/dist/core/godoc-introspector.js +144 -0
  11. package/dist/core/godoc-loader.d.ts +34 -0
  12. package/dist/core/godoc-loader.d.ts.map +1 -0
  13. package/dist/core/godoc-loader.js +491 -0
  14. package/dist/core/godoc-types.d.ts +109 -0
  15. package/dist/core/godoc-types.d.ts.map +1 -0
  16. package/dist/core/godoc-types.js +8 -0
  17. package/dist/core/markdown-loader.d.ts +10 -0
  18. package/dist/core/markdown-loader.d.ts.map +1 -1
  19. package/dist/core/search-indexer.d.ts.map +1 -1
  20. package/dist/core/search-indexer.js +9 -0
  21. package/dist/core/sourcey-godoc/cmd/sourcey-godoc/main.go +736 -0
  22. package/dist/core/sourcey-godoc/cmd/sourcey-godoc/site.go +497 -0
  23. package/dist/core/sourcey-godoc/cmd/sourcey-godoc/site_test.go +89 -0
  24. package/dist/core/sourcey-godoc/doc.go +11 -0
  25. package/dist/core/sourcey-godoc/go.mod +3 -0
  26. package/dist/dev-server.d.ts.map +1 -1
  27. package/dist/dev-server.js +42 -0
  28. package/dist/index.d.ts +1 -0
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +1 -0
  31. package/dist/site-assembly.d.ts +3 -0
  32. package/dist/site-assembly.d.ts.map +1 -1
  33. package/dist/site-assembly.js +30 -1
  34. package/dist/themes/default/sourcey.css +244 -0
  35. 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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AW,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;AAErF,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,yEAAyE;IACzE,IAAI,EAAE,MAAM,CAAC;IACb,2EAA2E;IAC3E,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,6DAA6D;IAC7D,MAAM,CAAC,EAAE,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;CAC1B;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,UAAU,EAAE,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AuDD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAIrD"}
@@ -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,CAAC;IACjB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAMD;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,EAClC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC,EAC9B,UAAU,EAAE,cAAc,EAC1B,SAAS,SAAM,EACf,aAAa,GAAE,MAAM,EAAO,EAC5B,UAAU,GAAE,UAAkB,GAC7B,MAAM,CAuFR"}
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,CAAC;IACjB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAMD;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,EAClC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC,EAC9B,UAAU,EAAE,cAAc,EAC1B,SAAS,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) {