@stati/core 1.19.0 → 1.20.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 (46) hide show
  1. package/dist/core/build.d.ts.map +1 -1
  2. package/dist/core/build.js +51 -7
  3. package/dist/core/dev.d.ts.map +1 -1
  4. package/dist/core/dev.js +17 -10
  5. package/dist/core/index.d.ts +1 -0
  6. package/dist/core/index.d.ts.map +1 -1
  7. package/dist/core/index.js +2 -0
  8. package/dist/core/markdown.d.ts +9 -0
  9. package/dist/core/markdown.d.ts.map +1 -1
  10. package/dist/core/markdown.js +12 -0
  11. package/dist/core/utils/html.utils.d.ts +35 -0
  12. package/dist/core/utils/html.utils.d.ts.map +1 -0
  13. package/dist/core/utils/html.utils.js +46 -0
  14. package/dist/core/utils/index.d.ts +2 -1
  15. package/dist/core/utils/index.d.ts.map +1 -1
  16. package/dist/core/utils/index.js +3 -1
  17. package/dist/core/utils/paths.utils.d.ts +27 -0
  18. package/dist/core/utils/paths.utils.d.ts.map +1 -1
  19. package/dist/core/utils/paths.utils.js +45 -0
  20. package/dist/metrics/recorder.d.ts.map +1 -1
  21. package/dist/metrics/types.d.ts +1 -0
  22. package/dist/metrics/types.d.ts.map +1 -1
  23. package/dist/search/auto-inject.d.ts +21 -0
  24. package/dist/search/auto-inject.d.ts.map +1 -0
  25. package/dist/search/auto-inject.js +33 -0
  26. package/dist/search/constants.d.ts +28 -0
  27. package/dist/search/constants.d.ts.map +1 -0
  28. package/dist/search/constants.js +27 -0
  29. package/dist/search/generator.d.ts +101 -0
  30. package/dist/search/generator.d.ts.map +1 -0
  31. package/dist/search/generator.js +278 -0
  32. package/dist/search/index.d.ts +24 -0
  33. package/dist/search/index.d.ts.map +1 -0
  34. package/dist/search/index.js +22 -0
  35. package/dist/seo/auto-inject.d.ts.map +1 -1
  36. package/dist/seo/auto-inject.js +5 -18
  37. package/dist/types/config.d.ts +3 -0
  38. package/dist/types/config.d.ts.map +1 -1
  39. package/dist/types/content.d.ts +6 -0
  40. package/dist/types/content.d.ts.map +1 -1
  41. package/dist/types/index.d.ts +1 -0
  42. package/dist/types/index.d.ts.map +1 -1
  43. package/dist/types/search.d.ts +121 -0
  44. package/dist/types/search.d.ts.map +1 -0
  45. package/dist/types/search.js +5 -0
  46. package/package.json +1 -1
@@ -0,0 +1,121 @@
1
+ /**
2
+ * Search index generation configuration and type definitions.
3
+ * @module types/search
4
+ */
5
+ /**
6
+ * Search index generation configuration.
7
+ * When enabled, Stati generates a JSON search index at build time.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * const config: StatiConfig = {
12
+ * search: {
13
+ * enabled: true,
14
+ * indexName: 'search-index',
15
+ * hashFilename: true,
16
+ * maxContentLength: 1000,
17
+ * maxPreviewLength: 500,
18
+ * headingLevels: [2, 3, 4],
19
+ * exclude: ['/private/**'],
20
+ * includeHomePage: false,
21
+ * autoInjectMetaTag: true,
22
+ * }
23
+ * };
24
+ * ```
25
+ */
26
+ export interface SearchConfig {
27
+ /** Enable search index generation. @default false */
28
+ enabled: boolean;
29
+ /** Base filename for the search index (without extension). @default 'search-index' */
30
+ indexName?: string;
31
+ /** Include content hash in filename for cache busting. @default true */
32
+ hashFilename?: boolean;
33
+ /** Maximum content length per section (in characters). @default 1000 */
34
+ maxContentLength?: number;
35
+ /** Maximum preview length for page-level entries (in characters). @default 500 */
36
+ maxPreviewLength?: number;
37
+ /** Heading levels to include in the index. @default [2, 3, 4, 5, 6] */
38
+ headingLevels?: number[];
39
+ /** Glob patterns for pages to exclude from the search index. @default [] */
40
+ exclude?: string[];
41
+ /** Include the home page (index) in the search index. @default false */
42
+ includeHomePage?: boolean;
43
+ /** Auto-inject search index meta tag into rendered HTML. @default true */
44
+ autoInjectMetaTag?: boolean;
45
+ }
46
+ /**
47
+ * A searchable document representing a page section.
48
+ * Each document is a searchable unit in the search index.
49
+ *
50
+ * @example
51
+ * ```typescript
52
+ * const doc: SearchDocument = {
53
+ * id: '/getting-started/installation#prerequisites',
54
+ * url: '/getting-started/installation',
55
+ * anchor: 'prerequisites',
56
+ * title: 'Installation',
57
+ * heading: 'Prerequisites',
58
+ * level: 2,
59
+ * content: 'Before installing Stati, ensure you have Node.js 22 or later...',
60
+ * breadcrumb: 'Getting Started > Installation',
61
+ * tags: ['setup', 'installation']
62
+ * };
63
+ * ```
64
+ */
65
+ export interface SearchDocument {
66
+ /** Unique identifier (page URL + section anchor) */
67
+ id: string;
68
+ /** Page URL path */
69
+ url: string;
70
+ /** Section anchor (heading ID), empty string for page-level entry */
71
+ anchor: string;
72
+ /** Page title from frontmatter */
73
+ title: string;
74
+ /** Section heading text */
75
+ heading: string;
76
+ /** Heading level (1 for page title, 2-6 for headings) */
77
+ level: number;
78
+ /** Text content of the section (stripped of HTML) */
79
+ content: string;
80
+ /** Breadcrumb path for display */
81
+ breadcrumb: string;
82
+ /** Optional tags from frontmatter */
83
+ tags?: string[];
84
+ }
85
+ /**
86
+ * The complete search index structure written to JSON.
87
+ * This is the output format for the generated search index file.
88
+ *
89
+ * @example
90
+ * ```typescript
91
+ * const index: SearchIndex = {
92
+ * version: '1.0.0',
93
+ * generatedAt: '2025-01-15T10:30:00.000Z',
94
+ * documentCount: 150,
95
+ * documents: [...]
96
+ * };
97
+ * ```
98
+ */
99
+ export interface SearchIndex {
100
+ /** Schema version for forward compatibility */
101
+ version: string;
102
+ /** ISO timestamp when the index was generated */
103
+ generatedAt: string;
104
+ /** Total document count */
105
+ documentCount: number;
106
+ /** Array of searchable documents */
107
+ documents: SearchDocument[];
108
+ }
109
+ /**
110
+ * Metadata about the generated search index.
111
+ * Used to pass search index information to templates and other parts of the build.
112
+ */
113
+ export interface SearchIndexMetadata {
114
+ /** Whether search index was generated */
115
+ enabled: boolean;
116
+ /** Full path to the search index file (e.g., '/search-index-a1b2c3d4.json') */
117
+ indexPath: string;
118
+ /** Document count in the index */
119
+ documentCount: number;
120
+ }
121
+ //# sourceMappingURL=search.d.ts.map
@@ -0,0 +1 @@
1
+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CAAC;IACpB,2BAA2B;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,oCAAoC;IACpC,SAAS,EAAE,cAAc,EAAE,CAAC;CAC7B;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,yCAAyC;IACzC,OAAO,EAAE,OAAO,CAAC;IACjB,+EAA+E;IAC/E,SAAS,EAAE,MAAM,CAAC;IAClB,kCAAkC;IAClC,aAAa,EAAE,MAAM,CAAC;CACvB"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Search index generation configuration and type definitions.
3
+ * @module types/search
4
+ */
5
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stati/core",
3
- "version": "1.19.0",
3
+ "version": "1.20.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",